Class WebSocketChannel

java.lang.Object
org.eclipse.jetty.websocket.api.WebSocketAdapter
marauroa.server.net.web.WebSocketChannel
All Implemented Interfaces:
org.eclipse.jetty.websocket.api.WebSocketListener, org.eclipse.jetty.websocket.api.WriteCallback

public class WebSocketChannel extends org.eclipse.jetty.websocket.api.WebSocketAdapter implements org.eclipse.jetty.websocket.api.WriteCallback
a websocket connection to a client
Author:
hendrik
  • Constructor Details

    • WebSocketChannel

      public WebSocketChannel()
  • Method Details

    • onWebSocketConnect

      public void onWebSocketConnect(org.eclipse.jetty.websocket.api.Session sess)
      Specified by:
      onWebSocketConnect in interface org.eclipse.jetty.websocket.api.WebSocketListener
      Overrides:
      onWebSocketConnect in class org.eclipse.jetty.websocket.api.WebSocketAdapter
    • onWebSocketText

      public void onWebSocketText(String message)
      Specified by:
      onWebSocketText in interface org.eclipse.jetty.websocket.api.WebSocketListener
      Overrides:
      onWebSocketText in class org.eclipse.jetty.websocket.api.WebSocketAdapter
    • onWebSocketClose

      public void onWebSocketClose(int statusCode, String reason)
      Specified by:
      onWebSocketClose in interface org.eclipse.jetty.websocket.api.WebSocketListener
      Overrides:
      onWebSocketClose in class org.eclipse.jetty.websocket.api.WebSocketAdapter
    • onWebSocketError

      public void onWebSocketError(Throwable cause)
      Specified by:
      onWebSocketError in interface org.eclipse.jetty.websocket.api.WebSocketListener
      Overrides:
      onWebSocketError in class org.eclipse.jetty.websocket.api.WebSocketAdapter
    • getAddress

      public InetSocketAddress getAddress()
      gets the ip-address and port
      Returns:
      address
    • getUsername

      public String getUsername()
      gets the username
      Returns:
      username
    • sendMessage

      public void sendMessage(String json)
      sends a message to the client
      Parameters:
      json - json string to send
    • close

      public void close()
    • writeFailed

      public void writeFailed(Throwable e)
      Specified by:
      writeFailed in interface org.eclipse.jetty.websocket.api.WriteCallback
    • writeSuccess

      public void writeSuccess()
      Specified by:
      writeSuccess in interface org.eclipse.jetty.websocket.api.WriteCallback