Documentation
¶
Overview ¶
Package connectionmanager provides communication between connections from different goroutines.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Information about a particular connection
type ConnectionManager ¶
type ConnectionManager struct {
// contains filtered or unexported fields
}
Manages connections
func (*ConnectionManager) SendMessage ¶
func (cm *ConnectionManager) SendMessage(r *Message) *Message
Sends a Message and receives a Message
to be called from other threads
func (*ConnectionManager) SetActive ¶
func (cm *ConnectionManager) SetActive(active bool)
Start or stop a connection manager service
type Message ¶
type Message struct {
// Type of message
Type MessageType
// ID associated with this message
Id string
// ID of recipient
DestId string
// Additional payload to be passed to recipient (or broadcast)
Payload *MessagePayload
// Channel for response
RChan chan *Message
// Channel for polling
PollChan chan *[]*Message
// Generic field for data passing
General interface{}
// Status for SendMessage return
Err error
}
Messages to and from the ConnectionManager
type MessageType ¶
type MessageType int32
Message type identifiers
const ( StopRequest MessageType = 0 StopResponse MessageType = 1 ConnectRequest MessageType = 2 ConnectResponse MessageType = 3 BroadcastRequest MessageType = 4 BroadcastResponse MessageType = 5 PollRequest MessageType = 6 PollResponse MessageType = 7 Broadcast MessageType = 8 )
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
chat
command
A long-polling HTTP chat server User Manager code for chat.go visible from chat.go
|
A long-polling HTTP chat server User Manager code for chat.go visible from chat.go |
|
chat/rabbits
command
Hammer away at the chat server with fake connections
|
Hammer away at the chat server with fake connections |
Click to show internal directories.
Click to hide internal directories.