Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/pyscript/pyscript
/ on_message
Function
on_message
core/tests/python/tests/test_websocket.py:40–43 ·
view source on GitHub ↗
(event)
Source
from the content-addressed store, hash-verified
38
ws.send(
"Hello, world!"
)
# A message to echo.
39
40
def
on_message(event):
41
messages.append(event.data)
42
if
len(messages) == 2:
# We're done.
43
ws.close()
44
45
def
on_close(event):
46
nonlocal closed_flag
Callers
nothing calls this directly
Calls
2
close
Method · 0.80
append
Method · 0.45
Tested by
no test coverage detected