Skip to content

Run the HTTP and WebSocket servers on the same port

Clément Pit-Claudel requested to merge cpc/single-port into main

Use Cask's built-in websocket implementation instead of a separate java_websocket server.

  • jvm/src/main/scala/cs214/webapp/server/web/WebServer.scala:
    Remove the WS_PORT parameter.
  • jvm/src/main/scala/cs214/webapp/server/web/WebServerRoutes.scala:
    (getAppInfo): Use HTTP_PORT instead of WS_PORT in wsEndpoint
    (websocket): New endpoint.
  • jvm/src/main/scala/cs214/webapp/server/web/WebSocketsCollection.scala:
    Remove java_websocket imports.
    Change from WebSocket to cask.WsChannelActor.
    Rename appId to instanceId where appropriate.
    (WebSocketsCollection): Remove the port parameter. (connect): New function, replacing the previous WebSocketServer instance.
  • shared/src/main/scala/cs214/webapp/Common.scala:
    (WS_PORT): Remove.
    (WebSocket): New endpoint.
  • shared/src/main/scala/cs214/webapp/Common.scala:
    (Endpoints): Add constants for /app and /ws paths.

Merge request reports

Loading