Class Socket

java.lang.Object
io.socket.emitter.Emitter
io.socket.client.Socket

public class Socket extends io.socket.emitter.Emitter
The socket class for Socket.IO Client.
  • Field Details

  • Constructor Details

  • Method Details

    • isActive

      public boolean isActive()
    • open

      public Socket open()
      Connects the socket.
    • connect

      public Socket connect()
      Connects the socket.
    • send

      public Socket send(Object... args)
      Send messages.
      Parameters:
      args - data to send.
      Returns:
      a reference to this object.
    • emit

      public io.socket.emitter.Emitter emit(String event, Object... args)
      Emits an event. When you pass Ack at the last argument, then the acknowledge is done.
      Overrides:
      emit in class io.socket.emitter.Emitter
      Parameters:
      event - an event name.
      args - data to send.
      Returns:
      a reference to this object.
    • emit

      public io.socket.emitter.Emitter emit(String event, Object[] args, Ack ack)
      Emits an event with an acknowledge.
      Parameters:
      event - an event name
      args - data to send.
      ack - the acknowledgement to be called
      Returns:
      a reference to this object.
    • close

      public Socket close()
      Disconnects the socket.
      Returns:
      a reference to this object.
    • disconnect

      public Socket disconnect()
      Disconnects the socket.
      Returns:
      a reference to this object.
    • io

      public Manager io()
    • connected

      public boolean connected()
    • id

      public String id()
      A property on the socket instance that is equal to the underlying engine.io socket id. The value is present once the socket has connected, is removed when the socket disconnects and is updated if the socket reconnects.
      Returns:
      a socket id
    • onAnyIncoming

      public Socket onAnyIncoming(io.socket.emitter.Emitter.Listener fn)
    • offAnyIncoming

      public Socket offAnyIncoming()
    • offAnyIncoming

      public Socket offAnyIncoming(io.socket.emitter.Emitter.Listener fn)
    • onAnyOutgoing

      public Socket onAnyOutgoing(io.socket.emitter.Emitter.Listener fn)
    • offAnyOutgoing

      public Socket offAnyOutgoing()
    • offAnyOutgoing

      public Socket offAnyOutgoing(io.socket.emitter.Emitter.Listener fn)