-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.go
43 lines (36 loc) · 955 Bytes
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package go_socketio_redis_adapter
import (
"io"
"net"
"net/http"
"net/url"
)
// EachFunc typed for each callback function.
type EachFunc func(Conn)
// Conn is a connection in go-socket.io.
type Conn interface {
io.Closer
Namespace
// ID returns session id
ID() string
URL() url.URL
LocalAddr() net.Addr
RemoteAddr() net.Addr
RemoteHeader() http.Header
}
// Namespace describes a communication channel that allows you to split the logic of your application
// over a single shared connection.
type Namespace interface {
// Context of this connection. You can save one context for one
// connection, and share it between all handlers. The handlers
// are called in one goroutine, so no need to lock context if it
// only accessed in one connection.
Context() interface{}
SetContext(ctx interface{})
Namespace() string
Emit(eventName string, v ...interface{})
Join(room string)
Leave(room string)
LeaveAll()
Rooms() []string
}