SocketFezPostData

struct SocketFezPostData : Content

FezPostData, modified to be easier for sockets.

Fez and Seamail socket clients will receive this message as a JSON string when a user posts in the fez/seamail. Posts made by a user will be reflected back to them via this socket. If a user is logged on from 2 clients and both have open sockets, both clients will see the socket message when the user posts a new message from one of the clients. Each struct contains the UserHeader of the poster instead of the author’s UUID; this way clients (okay, the javascript web client) can format the post without additional requests.

Note: Fezzes have other state changes that don’t currently have websocket notifications. Your socket message handler should gracefully handle the possibility that you receive a message that doesn’t fit any of the currently documented message structs.

See:

  • WS /api/v3/fez/:fezID/socket
  • PostID of the new post

    Declaration

    Swift

    var postID: Int
  • User that posted. Should be a current member of the fez; socket should get a SocketMemberChangeData adding a new user before any posts by that user. But, there’s a possible race condition where membership could change before the socket is opened. Unless you update FezData after opening the socket, you may see posts from users that don’t appear to be members of the fez.

    Declaration

    Swift

    var author: UserHeader
  • The text of this post.

    Declaration

    Swift

    var text: String
  • When the post was made.

    Declaration

    Swift

    var timestamp: Date
  • An optional image that may be attached to the post.

    Declaration

    Swift

    var image: String?
  • HTML fragment for the post, using the Swiftarr Web UI’s front end. Fragment is built using the same semantic data available in the other fields in this struct. Please don’t try parsing this to gather data. This field is here so the Javascript can insert HTML that matches what the HTTP endpoints render.

    Declaration

    Swift

    var html: String?
  • Declaration

    Swift

    init(post: FezPostData)
  • Declaration

    Swift

    init(post: FezPost, author: UserHeader) throws