All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.javadoc.org.spincast.plugins.undertow.SpincastWebsocketEndpoint.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version






SpincastWebsocketEndpoint (org.spincast:spincast-framework 1.0.0 API)












org.spincast.plugins.undertow

Class SpincastWebsocketEndpoint

    • Field Detail

      • logger

        protected final org.slf4j.Logger logger
      • EXCHANGE_VARIABLE_PEER_ID

        public static final String EXCHANGE_VARIABLE_PEER_ID
    • Method Detail

      • init

        @Inject
        protected void init()
      • getWebSocketChannelByPeerId

        protected Map<String,io.undertow.websockets.core.WebSocketChannel> getWebSocketChannelByPeerId()
      • getNewPeerIdLock

        protected Object getNewPeerIdLock(String peerId)
        Gets the creation lock for a peer id.
      • removePeerChannelAndSendPeerClosedAppEvent

        protected void removePeerChannelAndSendPeerClosedAppEvent(String peerId)
      • removePeerChannel

        protected void removePeerChannel(String peerId)
      • managePeersWriteConnectionClosed

        protected void managePeersWriteConnectionClosed(Set<String> peerIds)
        Called when a write operation detected a closed connection on some peers.
      • closeEndpoint

        public void closeEndpoint()
        Description copied from interface: WebsocketEndpointManager
        Closes the entire WebSocket endpoint. All peer connections of this endpoint will be closed and the endpoint will be removed.

        Will try to send a "closing" message to the peers before closing their connection.

        Specified by:
        closeEndpoint in interface WebsocketEndpointManager
      • closeEndpoint

        public void closeEndpoint(boolean sendClosingMessageToPeers)
        Description copied from interface: WebsocketEndpointManager
        Closes the entire WebSocket endpoint. All peer connections of this endpoint will be closed and the endpoint will be removed.
        Specified by:
        closeEndpoint in interface WebsocketEndpointManager
        Parameters:
        sendClosingMessageToPeers - if true, Spincast will try to send a "closing" message to the peers before closing their connections.
      • closeEndpoint

        public void closeEndpoint(int closingCode,
                                  String closingReason)
        Description copied from interface: WebsocketEndpointManager
        Closes the entire WebSocket endpoint. All peer connections of this endpoint will be closed and the endpoint will be removed.

        Will try to send a "closing" message to the peers before closing their connection.

        Specified by:
        closeEndpoint in interface WebsocketEndpointManager
      • closeEndpoint

        protected void closeEndpoint(int closingCode,
                                     String closingReason,
                                     boolean sendClosingMessageToPeers)
      • validateWebsocketClosingCode

        protected void validateWebsocketClosingCode(int closingCode)
        Is the Websocket closing code valid?
        Throws:
        an - expcetion is the code is not valid.
      • startSendingPings

        protected void startSendingPings()
        Starts sending automatic pings to the peers.
      • stopSendingPings

        protected void stopSendingPings()
      • getWebSocketProtocolHandshakeHandler

        protected io.undertow.websockets.WebSocketProtocolHandshakeHandler getWebSocketProtocolHandshakeHandler()
        The handler to use for the Websocket connection.
      • sendOnPeerConnectedAppEvent

        protected void sendOnPeerConnectedAppEvent(String peerId)
        Sends a "Peer connected " event to the app.
      • sendOnStringMessageAppEvent

        protected void sendOnStringMessageAppEvent(String peerId,
                                                   String message)
        Sends a "String message" event to the app.
      • sendOnBytesMessageAppEvent

        protected void sendOnBytesMessageAppEvent(String peerId,
                                                  byte[] message)
        Sends a "byte[] message" event to the app.
      • sendPeerClosedAppEvent

        protected void sendPeerClosedAppEvent(String peerId)
        Sends a "peer closed" event to the app.
      • sendAppEventInNewThread

        protected void sendAppEventInNewThread(Runnable runnable)
        Sends an event to the application in a separated thread.
      • getThreadExecutorForAppEventsTimeoutAmount

        protected int getThreadExecutorForAppEventsTimeoutAmount()
        The timeout amount before cancelling a task when sending events to the application.
      • getThreadExecutorForAppEventsTimeoutTimeUnit

        protected TimeUnit getThreadExecutorForAppEventsTimeoutTimeUnit()
        The timeout unit before cancelling a task when sending events to the application.
      • getThreadExecutorForAppEvents

        protected ExecutorService getThreadExecutorForAppEvents()
        The ExecutorService to use to send events to the application.
      • getThreadExecutorForAppEventsThreadNumber

        protected int getThreadExecutorForAppEventsThreadNumber()
        The maximum number of concurrent threads used when sending events to the application.
      • getThreadExecutorForAppEventsThreadThreadFactory

        protected ThreadFactory getThreadExecutorForAppEventsThreadThreadFactory()
        The ThreadFactory to use for the Executor that sends events to the application.
        Returns:
        the ThreadFactory to use or null to use the default one.

Copyright © 2019. All rights reserved.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy