Package com.adobe.granite.socketio
Interface SocketIOEmitter
-
- All Known Subinterfaces:
SocketIONamespace
,SocketIOSocket
@ProviderType public interface SocketIOEmitter
Socket.io event emitter. Examples: <xmp> namespace.emit(); // all sockets in namespace namespace.to(r1).emit(); // all sockets in room 'r1' namepsace.broadcast().emit(); // same as above socket.emit(); // only to self socket.broadcast().emit(); // to all sockets excluding self socket.broadcast().to(r1).emit(); // to all sockets in room 'r1', excluding self socket.to(r1).emit(); // to all sockets in room 'r1', including self </xmp>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SocketIOEmitter
emit(java.lang.String eventName, java.lang.Object... arguments)
Emits an event to the socket identified by the string name.SocketIOEmitter
emit(java.lang.String eventName, JSONArray arguments)
Emits an event to the socket identified by the string name.SocketIOEmitter
to(java.lang.String... room)
Sets a modifier for a subsequent event emission that the event will only be broadcast to sockets that have joined the given room.
-
-
-
Method Detail
-
emit
@Nonnull SocketIOEmitter emit(@Nonnull java.lang.String eventName, @Nonnull java.lang.Object... arguments) throws java.io.IOException
Emits an event to the socket identified by the string name. Any other parameters can be included.- Parameters:
eventName
- name of the eventarguments
- optional arguments- Returns:
- emitter
- Throws:
java.io.IOException
- error
-
emit
@Nonnull SocketIOEmitter emit(@Nonnull java.lang.String eventName, @Nonnull JSONArray arguments) throws java.io.IOException
Emits an event to the socket identified by the string name. Any other parameters can be included.- Parameters:
eventName
- name of the eventarguments
- optional arguments- Returns:
- emitter
- Throws:
java.io.IOException
- error
-
to
@Nonnull SocketIOEmitter to(@Nonnull java.lang.String... room)
Sets a modifier for a subsequent event emission that the event will only be broadcast to sockets that have joined the given room. To emit to multiple rooms, you can call to several times.- Parameters:
room
- name of the room- Returns:
- a new emitter that will broadcast the events
-
-