public synchronized void connect ( ) { if ( state != State . NONE ) { eventHandler . onError ( new WebSocketException ( "connect() already called" ) ) ; close ( ) ; return ; } getIntializer ( ) . setName ( getInnerThread ( ) , THREAD_BASE_NAME + "Reader-" + clientId ) ; state = State . CONNECTING ; getInnerThread ( ) . start ( ) ; }
Start up the socket . This is non - blocking it will fire up the threads used by the library and then trigger the onOpen handler once the connection is established .