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 Detail

      • to

        @Nonnull
        SocketIOEmitter to​(@Nonnull
                           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