Class WebsocketListenerAdapter

java.lang.Object
com.neovisionaries.ws.client.WebSocketAdapter
de.chojo.universalis.websocket.listener.WebsocketListenerAdapter
All Implemented Interfaces:
com.neovisionaries.ws.client.WebSocketListener, EventListener

public class WebsocketListenerAdapter extends com.neovisionaries.ws.client.WebSocketAdapter implements EventListener
The listener to receive and forward the WsEvents to the registered EventListeners.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new websocket listener adapter
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onBinaryMessage(com.neovisionaries.ws.client.WebSocket websocket, byte[] binary)
     
    void
    onError(com.neovisionaries.ws.client.WebSocket websocket, com.neovisionaries.ws.client.WebSocketException cause)
     
    void
    Called when a listing was added.
    void
    Called when a listing was removed.
    void
    Called when a listing was added after getting removed.
    void
    Called when sales were added.
    void
    Called when sales were removed.

    Methods inherited from class com.neovisionaries.ws.client.WebSocketAdapter

    handleCallbackError, onBinaryFrame, onCloseFrame, onConnected, onConnectError, onContinuationFrame, onDisconnected, onFrame, onFrameError, onFrameSent, onFrameUnsent, onMessageDecompressionError, onMessageError, onPingFrame, onPongFrame, onSendError, onSendingFrame, onSendingHandshake, onStateChanged, onTextFrame, onTextMessage, onTextMessage, onTextMessageError, onThreadCreated, onThreadStarted, onThreadStopping, onUnexpectedError

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WebsocketListenerAdapter

      public WebsocketListenerAdapter(List<EventListener> listeners, NameSupplier itemNameSupplier)
      Creates a new websocket listener adapter
      Parameters:
      listeners - listeners to register
      itemNameSupplier - item name supplier
  • Method Details

    • onBinaryMessage

      public void onBinaryMessage(com.neovisionaries.ws.client.WebSocket websocket, byte[] binary) throws Exception
      Specified by:
      onBinaryMessage in interface com.neovisionaries.ws.client.WebSocketListener
      Overrides:
      onBinaryMessage in class com.neovisionaries.ws.client.WebSocketAdapter
      Throws:
      Exception
    • onError

      public void onError(com.neovisionaries.ws.client.WebSocket websocket, com.neovisionaries.ws.client.WebSocketException cause)
      Specified by:
      onError in interface com.neovisionaries.ws.client.WebSocketListener
      Overrides:
      onError in class com.neovisionaries.ws.client.WebSocketAdapter
    • onListingAdd

      public void onListingAdd(ListingAddEvent event)
      Description copied from interface: EventListener
      Called when a listing was added.
      Specified by:
      onListingAdd in interface EventListener
      Parameters:
      event - add event
    • onListingRemove

      public void onListingRemove(ListingRemoveEvent event)
      Description copied from interface: EventListener
      Called when a listing was removed. This usually happens right before a EventListener.onListingAdd(ListingAddEvent) call.
      Specified by:
      onListingRemove in interface EventListener
      Parameters:
      event - remove event
    • onListingUpdate

      public void onListingUpdate(ListingUpdateEvent event)
      Description copied from interface: EventListener
      Called when a listing was added after getting removed. This usually means it was updated.

      This only works when Subscriptions.listingAdd() and Subscriptions.listingRemove() are subscribed for this world.

      This event is created manually. It completely relies on universalis sending the remove event directly before the send event.

      Specified by:
      onListingUpdate in interface EventListener
      Parameters:
      event - update event
    • onSalesAdd

      public void onSalesAdd(SalesAddEvent event)
      Description copied from interface: EventListener
      Called when sales were added.
      Specified by:
      onSalesAdd in interface EventListener
      Parameters:
      event - add event
    • onSalesRemove

      public void onSalesRemove(SalesRemoveEvent event)
      Description copied from interface: EventListener
      Called when sales were removed.
      Specified by:
      onSalesRemove in interface EventListener
      Parameters:
      event - remove event