public class Socket
extends io.socket.emitter.Emitter
Modifier and Type | Field and Description |
---|---|
static String |
EVENT_CONNECT
Called on a connection.
|
static String |
EVENT_CONNECT_ERROR |
static String |
EVENT_CONNECT_TIMEOUT |
static String |
EVENT_CONNECTING |
static String |
EVENT_DISCONNECT
Called on a disconnection.
|
static String |
EVENT_ERROR
Called on a connection error.
|
static String |
EVENT_MESSAGE |
static String |
EVENT_PING |
static String |
EVENT_PONG |
static String |
EVENT_RECONNECT |
static String |
EVENT_RECONNECT_ATTEMPT |
static String |
EVENT_RECONNECT_ERROR |
static String |
EVENT_RECONNECT_FAILED |
static String |
EVENT_RECONNECTING |
protected static Map<String,Integer> |
events |
Constructor and Description |
---|
Socket(Manager io,
String nsp,
Manager.Options opts) |
Modifier and Type | Method and Description |
---|---|
Socket |
close()
Disconnects the socket.
|
Socket |
connect()
Connects the socket.
|
boolean |
connected() |
Socket |
disconnect()
Disconnects the socket.
|
io.socket.emitter.Emitter |
emit(String event,
Object... args)
Emits an event.
|
io.socket.emitter.Emitter |
emit(String event,
Object[] args,
Ack ack)
Emits an event with an acknowledge.
|
String |
id()
A property on the socket instance that is equal to the underlying engine.io socket id.
|
Manager |
io() |
Socket |
open()
Connects the socket.
|
Socket |
send(Object... args)
Send messages.
|
public static final String EVENT_CONNECT
public static final String EVENT_CONNECTING
public static final String EVENT_DISCONNECT
public static final String EVENT_ERROR
Parameters:
public static final String EVENT_MESSAGE
public static final String EVENT_CONNECT_ERROR
public static final String EVENT_CONNECT_TIMEOUT
public static final String EVENT_RECONNECT
public static final String EVENT_RECONNECT_ERROR
public static final String EVENT_RECONNECT_FAILED
public static final String EVENT_RECONNECT_ATTEMPT
public static final String EVENT_RECONNECTING
public static final String EVENT_PING
public static final String EVENT_PONG
public Socket(Manager io, String nsp, Manager.Options opts)
public Socket open()
public Socket connect()
public Socket send(Object... args)
args
- data to send.public io.socket.emitter.Emitter emit(String event, Object... args)
Ack
at the last argument, then the acknowledge is done.emit
in class io.socket.emitter.Emitter
event
- an event name.args
- data to send.public io.socket.emitter.Emitter emit(String event, Object[] args, Ack ack)
event
- an event nameargs
- data to send.ack
- the acknowledgement to be calledpublic Socket close()
public Socket disconnect()
public Manager io()
public boolean connected()
public String id()
Copyright © 2017. All rights reserved.