-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsocket_client.go
49 lines (33 loc) · 1.18 KB
/
socket_client.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
44
45
46
47
48
49
package sio
type (
ClientSocket interface {
Socket
ClientSocketEvents
// Whether the socket will try to reconnect when its Client (manager) connects or reconnects.
Active() bool
// Connect the socket.
Connect()
// Disconnect the socket (a DISCONNECT packet will be sent).
Disconnect()
// Retrieves the Manager.
Manager() *Manager
// Setting the authentication data is optional and if used, it must be a JSON object (struct or map).
// Non-JSON-object authentication data will not accepted, and panic will occur.
SetAuth(v any)
// Get the authentication data that was set by `SetAuth`.
// As you might have guessed, returns nil if authentication data was not set before.
Auth() (v any)
Volatile() Emitter
}
ClientSocketEvents interface {
OnConnect(f ClientSocketConnectFunc)
OnceConnect(f ClientSocketConnectFunc)
OffConnect(f ...ClientSocketConnectFunc)
OnConnectError(f ClientSocketConnectErrorFunc)
OnceConnectError(f ClientSocketConnectErrorFunc)
OffConnectError(f ...ClientSocketConnectErrorFunc)
OnDisconnect(f ClientSocketDisconnectFunc)
OnceDisconnect(f ClientSocketDisconnectFunc)
OffDisconnect(f ...ClientSocketDisconnectFunc)
}
)