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 |
offAnyIncoming() |
Socket |
offAnyIncoming(io.socket.emitter.Emitter.Listener fn) |
Socket |
offAnyOutgoing() |
Socket |
offAnyOutgoing(io.socket.emitter.Emitter.Listener fn) |
Socket |
onAnyIncoming(io.socket.emitter.Emitter.Listener fn) |
Socket |
onAnyOutgoing(io.socket.emitter.Emitter.Listener fn) |
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()
public Socket onAnyIncoming(io.socket.emitter.Emitter.Listener fn)
public Socket offAnyIncoming()
public Socket offAnyIncoming(io.socket.emitter.Emitter.Listener fn)
public Socket onAnyOutgoing(io.socket.emitter.Emitter.Listener fn)
public Socket offAnyOutgoing()
public Socket offAnyOutgoing(io.socket.emitter.Emitter.Listener fn)
Copyright © 2022. All rights reserved.