websocket-sharp icon indicating copy to clipboard operation
websocket-sharp copied to clipboard

Trigger event after client connected on server side

Open Lukasz199312 opened this issue 7 years ago • 2 comments

Hello, i want call few function initialization after client success connected. Does server has onOpen method or something similar?

Lukasz199312 avatar Nov 04 '18 09:11 Lukasz199312

@Lukasz199312 yes, have you had time to read the docs?

segg21 avatar Dec 08 '18 07:12 segg21

@Lukasz199312 yes, have you had time to read the docs?

The WebSocketBehavior.OnOpen and WebSocketBehavior.OnClose event is fired only when the server's session is opened or closed, NOT when a new client has established a connection to the server or disconnected from the server.

There is no such thing as WebSocketBehavior.OnConnect or WebSocketBehavior.OnDisconnect event fired when the client connected or disconnected from the server, even though it does make sense to have it as an event already because otherwise you'd have to check the clients list by each "tick" or make a new interface for notifying connection (and not to mention that they both are technically bad practices). I wonder why.

CrackThrough avatar Jan 02 '22 13:01 CrackThrough