Olivine-Labs/Alchemy-Websockets — Issue #11: UserSocket Connect not behaving like expected
Author: ShyRed
Created: 2011-11-24 07:58:34+00:00
State: open

The server side ```UserContext``` Connect delegate does not behave like one might expect...

**What I expect:**
The Connect delegate is called once the connection establishing and handshake are complete, so I can greet every newly connected user with a "welcome message" inside the Connect delegate.

**What happens:**
The Connect delegate is called before the handshake which causes errors / disconnects, if one messages the client inside the Connect delegate.

**Workaround:**
Right now you have to poll the ```UserContext.IsSetup``` property in order to find out when a client is ready for receiving custom messages.

**Solution:**
1) Call the Connect delegate after the handshake.
*OR*
2) Split the delegate into 2 separate delegates: Connecting (is called before handshake) and Connected (is called after handshake).