-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathevents.go
42 lines (33 loc) · 896 Bytes
/
events.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
package sseio
type Event interface {
String() string
}
// RoomCreateEvent will be triggered when a room is created by client.
type RoomCreateEvent struct {
RoomId string
}
func (e *RoomCreateEvent) String() string {
return "room:create"
}
// RoomEmptyEvent will be triggered when there is no client in the room. And the room will be deleted.
type RoomEmptyEvent struct {
RoomId string
}
func (e *RoomEmptyEvent) String() string {
return "room:empty"
}
// ConnectionCreateEvent will be triggered when a connection is created.
type ConnectionCreateEvent struct {
ClientId string
Context Context
}
func (c *ConnectionCreateEvent) String() string {
return "connection:create"
}
// ConnectionCreateEvent will be triggered when a connection is closed.
type ConnectionCloseEvent struct {
ClientId string
}
func (c *ConnectionCloseEvent) String() string {
return "connection:close"
}