playframework / playframework/playframework

Outdated doc for Websockets

Open
#6,408 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic:documentation
Dominant language
Scala
Stars
12.6k
Forks
4k
Avg merge
2d 3h
Merged PRs (30d)
29

Description

Play Version (2.5.4)
API (Scala)
Operating System (MacOS 10.11)

Hello, I try to get familiar with WebSockets in Play. I am following https://www.playframework.com/documentation/2.5.x/ScalaWebSockets#closing-a-websocket. After a few hours wasted I found out that this doc is probably outdated. In current Play you close Websocket connection by closing underlying akka-stream. Would be great if you can update docs accordingly.

Probably you don't need a reproducer because I feel it's expected behavior, but just in case:

Expected Behavior
  1. after sending PoisonPill connection is getting closed
Actual Behavior

after sending PoisonPill connection is not getting closed. I base that on:

  1. my client's callback onclose is not fired,
  2. Chrome's network Tab shows WS connection as Pending
Reproducible Test Case

you can see this code at https://github.com/note/play-ws-example, here's what is essential for this case: https://github.com/note/play-ws-example/blob/master/app/controllers/WebSocketController.scala. I also included my JS code here: https://github.com/note/play-ws-example/tree/master/client

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Scala WebSockets documentation at the linked closing-a-websocket section and compare its guidance with app/controllers/WebSocketController.scala in the linked example. Check the client code and browser behavior described in the issue, then update the documentation to match the current connection-closing behavior and confirm the example's WebSocket closes as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, scala
Domain
documentation, networking
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.