Documentation ¶
Overview ¶
Package websockets manages active websocket connections and messages received from and sent to them
Index ¶
- Variables
- func ConstructThread(req ThreadCreationRequest, ip string, parseBody bool) (id uint64, timeStamp int64, hasImage bool, err error)
- func Handler(res http.ResponseWriter, req *http.Request)
- type Client
- type ClientMap
- type ImageRequest
- type ReplyCreationRequest
- type SyncID
- type ThreadCreationRequest
Constants ¶
This section is empty.
Variables ¶
var Clients = ClientMap{ // contains filtered or unexported fields }
Clients stores all synchronized websocket clients in a thread-safe map
Functions ¶
func ConstructThread ¶
func ConstructThread(req ThreadCreationRequest, ip string, parseBody bool) ( id uint64, timeStamp int64, hasImage bool, err error, )
ConstructThread creates a new tread and writes it to the database. Returns the ID of the thread and its creation timestamp
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client stores and manages a websocket-connected remote client and its interaction with the server and database
func (*Client) Close ¶
Close closes a websocket connection with the provided status code and optional reason
type ClientMap ¶
ClientMap is a thread-safe store for all clients connected to this server instance
type ImageRequest ¶
ImageRequest contains data for allocating an image
type ReplyCreationRequest ¶
type ReplyCreationRequest struct { Image ImageRequest auth.SessionCreds Name, Password, Body string }
ReplyCreationRequest contains common fields for both thread and reply creation
type SyncID ¶
SyncID contains the board and thread the client are currently synced to. If the client is on the board page, thread = 0.
type ThreadCreationRequest ¶
type ThreadCreationRequest struct { ReplyCreationRequest Subject, Board, Captcha string }
ThreadCreationRequest contains data for creating a new thread