Package io.socket.engineio.server
Class Emitter
java.lang.Object
io.socket.engineio.server.Emitter
- Direct Known Subclasses:
EngineIoServer,EngineIoSocket,EngineIoWebSocket,Transport
The event emitter which is ported from the JavaScript module. This class is thread-safe.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<String, ConcurrentLinkedQueue<Emitter.Listener>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecutes each of listeners with the given args.booleanhasListeners(String event) Check if this emitter has listeners for the specified event.Returns a list of listeners for the specified event.off()Removes all registered listeners.Removes all listeners of the specified event.off(String event, Emitter.Listener fn) Removes the listener.on(String event, Emitter.Listener fn) Listens on the event.once(String event, Emitter.Listener fn) Adds a one time listener for the event.private static booleansameAs(Emitter.Listener fn, Emitter.Listener internal)
-
Field Details
-
mCallbacks
-
-
Constructor Details
-
Emitter
public Emitter()
-
-
Method Details
-
on
Listens on the event.- Parameters:
event- event name.fn- Event listener.- Returns:
- a reference to this object.
-
once
Adds a one time listener for the event.- Parameters:
event- an event name.fn- Event listener.- Returns:
- a reference to this object.
-
off
Removes all registered listeners.- Returns:
- a reference to this object.
-
off
Removes all listeners of the specified event.- Parameters:
event- an event name.- Returns:
- a reference to this object.
-
off
Removes the listener.- Parameters:
event- an event name.fn- Event listener.- Returns:
- a reference to this object.
-
emit
Executes each of listeners with the given args.- Parameters:
event- an event name.args- Data to emit.- Returns:
- a reference to this object.
-
listeners
Returns a list of listeners for the specified event. The returned list is not modifiable.- Parameters:
event- an event name.- Returns:
- a reference to this object.
-
hasListeners
Check if this emitter has listeners for the specified event.- Parameters:
event- an event name.- Returns:
- a reference to this object.
-
sameAs
-