mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 12:31:58 +00:00
add websocket/Connection#IsJoined as requested at https://github.com/kataras/iris/issues/895
Former-commit-id: 560fc8b911a9c1352be577d2f7bebd1fac7b5d4a
This commit is contained in:
@@ -174,6 +174,9 @@ type (
|
||||
On(string, MessageFunc)
|
||||
// Join registers this connection to a room, if it doesn't exist then it creates a new. One room can have one or more connections. One connection can be joined to many rooms. All connections are joined to a room specified by their `ID` automatically.
|
||||
Join(string)
|
||||
// IsJoined returns true when this connection is joined to the room, otherwise false.
|
||||
// It Takes the room name as its input parameter.
|
||||
IsJoined(roomName string) bool
|
||||
// Leave removes this connection entry from a room
|
||||
// Returns true if the connection has actually left from the particular room.
|
||||
Leave(string) bool
|
||||
@@ -506,6 +509,10 @@ func (c *connection) Join(roomName string) {
|
||||
c.server.Join(roomName, c.id)
|
||||
}
|
||||
|
||||
func (c *connection) IsJoined(roomName string) bool {
|
||||
return c.server.IsJoined(roomName, c.id)
|
||||
}
|
||||
|
||||
func (c *connection) Leave(roomName string) bool {
|
||||
return c.server.Leave(roomName, c.id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user