Sending message from server to client when web socket is opened.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- backend, networking
Research direction
Start with the extended chat example and trace ChatWebSocketHandler.opened(), including the direct send and the websocket-broadcast publication. Check how the WebSocketPlugin pool handles a newly opened connection; done means a client receives the initial server message without the socket being terminated.
Written by the indexing model from the issue text.
Description
Gang:
I'm working with the extended chat example (works great out of the box), and trying to send a message from the server to the client when the web socket is initially opened:
class ChatWebSocketHandler(WebSocket):
def opened(self):
cherrypy.engine.publish('add-client', self.username, self)
self.send("Hello, World!")
However, this causes the web socket to be terminated. I've also tried publishing the message:
class ChatWebSocketHandler(WebSocket):
def opened(self):
cherrypy.engine.publish('add-client', self.username, self)
cherrypy.engine.publish("websocket-broadcast", "Hello, World!")
... which doesn't terminate the web socket, but doesn't send the message to the newly-connected client either (I assume this is because the broadcast is going out before the handler has been transferred to the WebSocketPlugin pool).
I'm looking to use web sockets for purely one-way publishing of a data feed from server to client(s), so this seems like a pretty basic use-case. What am I missing?
Thanks in advance,
Tim
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 286
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Lawouach/WebSocket-for-Python
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Lawouach/WebSocket-for-Python#300 ·
-
This project is not well maintained so be very very very patient!May be free again @Lawouach claimed this 656 days ago, and no pull request is open. Openquestion
Lawouach/WebSocket-for-Python#297 · 2 comments · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
Lawouach/WebSocket-for-Python#296 ·
-
Make the codes python 3 compatibleMay be free again @auvipy claimed this 1062 days ago, and no pull request is open. Open
Lawouach/WebSocket-for-Python#280 · 1 comment · 1 assignee ·
-
Setup new CIMay be free again @auvipy claimed this 1234 days ago, and no pull request is open. Open
Lawouach/WebSocket-for-Python#275 · 1 assignee ·
All issues in Lawouach/WebSocket-for-Python
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
QuantEcon/lecture-python-programming#642 ·
Maintainers usually reply within 1 day
-
area/config area/profiles comp/cli needs-decision P3 sweeper:risk-compatibility type/feature
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NousResearch/hermes-agent#133697 ·
Maintainers usually reply within 1 day
-
enhancement needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
core
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vectorize-io/hindsight#5279 ·
Maintainers usually reply within 1 day