Beispiel #1
0
func newConnection(websocketConn *websocket.Conn, s *server) *connection {
	c := &connection{
		id:        utils.RandomString(64),
		underline: websocketConn,
		send:      make(chan []byte, 256),
		onDisconnectListeners:    make([]DisconnectFunc, 0),
		onErrorListeners:         make([]ErrorFunc, 0),
		onNativeMessageListeners: make([]NativeMessageFunc, 0),
		onEventListeners:         make(map[string][]MessageFunc, 0),
		server:                   s,
	}

	c.self = newEmitter(c, c.id)
	c.broadcast = newEmitter(c, NotMe)
	c.all = newEmitter(c, All)

	return c
}
Beispiel #2
0
// GetName ...
func (t *Plugin) GetName() string {
	return Name + "[" + utils.RandomString(10) + "]" // this allows the specific plugin to be registed more than one time
}