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
Called on a connection error.
|
static String |
EVENT_DISCONNECT
Called on a disconnection.
|
protected static Map<String,Integer> |
RESERVED_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() |
boolean |
isActive() |
Socket |
open()
Connects the socket.
|
Socket |
send(Object... args)
Send messages.
|
public static final String EVENT_CONNECT
public static final String EVENT_DISCONNECT
public static final String EVENT_CONNECT_ERROR
Parameters:
public Socket(Manager io, String nsp, Manager.Options opts)
public boolean isActive()
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 © 2021. All rights reserved.