Connects to the gateway server, establishing the long poll communication with the gateway server to be notified of server-side events.
The connect is performed in two steps:
- first, a connect message is sent to the gateway server; the gateway server will notice this is a first connect message and reply immediately with an empty response
- second, another connect message is sent to the gateway server which interprets it as a long poll request
The long poll request may return either because one or more server-side events happened, or because it expired.
Any connect message after the first is treated as a long poll request.
@throws IOException if it is not possible to connect to the gateway server
@see #disconnect()