Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ID string // socket is the web socket for this client. Socket *websocket.Conn // send is a channel on which messages are sent. Send chan []byte // room is the room this client is chatting in. Room *Room }
Client represents a single chatting user.
type Message ¶
type Message struct { ID string `json:"ID"` Sender string Timestamp int64 Content string `json:"content"` }
Message describe a message sent and receive between clients
type RawClientMessage ¶
RawClientMessage describe a message sent from a client
type Room ¶
type Room struct { ID string // Forward is a channel that holds incoming messages // that should be forwarded to the other clients. Forward chan *RawClientMessage // join is a channel for clients wishing to join the room. Join chan *Client // Leave is a channel for clients wishing to Leave the room. Leave chan *Client // contains filtered or unexported fields }
Room define model for a room
func (*Room) GetMessages ¶
GetMessages returns room's valid messages
Click to show internal directories.
Click to hide internal directories.