Class SocketListener

  • All Implemented Interfaces:

    
    public class SocketListener
    
                        

    Listener which is invoked for WebSocket events.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      SocketListener()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Boolean getDeliverOnMainThread() The callbacks are by default delivered on the main thread.
      Unit onConnecting() Invoked when the connection begins to establish and socket state changes to Connecting.
      Unit onConnected(ConnectedEvent event) Invoked when we receive the first ConnectedEvent in this connection.
      Unit onDisconnected(DisconnectCause cause) Invoked when the web socket connection is disconnected.
      Unit onError(Error error) Invoked when there is any error in this web socket connection.
      Unit onEvent(ChatEvent event) Invoked when we receive any successful event.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SocketListener

        SocketListener()
    • Method Detail

      • getDeliverOnMainThread

         Boolean getDeliverOnMainThread()

        The callbacks are by default delivered on the main thread. Changing this property to false will deliver the callbacks on their originating threads.

        Set to false for faster callback delivery on the original thread (no unnecessary context switching).

      • onConnecting

         Unit onConnecting()

        Invoked when the connection begins to establish and socket state changes to Connecting.

      • onError

         Unit onError(Error error)

        Invoked when there is any error in this web socket connection.

        Parameters:
        error - Error object with the error details.
      • onEvent

         Unit onEvent(ChatEvent event)

        Invoked when we receive any successful event.

        Parameters:
        event - parsed ChatEvent received in this web socket connection.