← index #348PR #228
Related · high · value 3.186
QUERY · ISSUE

uasyncio.websocket.server import websocket

openby mrwhy-origopened 2019-08-23updated 2019-09-08

I like to use the uasyncio.websocket.server implementation but there is an import for websockets package defined. Where can I find this package?

1 comment
jomasnash · 2019-09-08

That is because server.py imports websocket instead of uwebsocket.

Fix:
diff --git a/uasyncio.websocket.server/uasyncio/websocket/server.py b/uasyncio.websocket.server/uasyncio/websocket/server.py
index 046b071..d721fb5 100644
--- a/uasyncio.websocket.server/uasyncio/websocket/server.py
+++ b/uasyncio.websocket.server/uasyncio/websocket/server.py
@@ -1,6 +1,6 @@
import uasyncio
import uhashlib, ubinascii
-import websocket
+import uwebsocket as websocket

CANDIDATE · PULL REQUEST

WIP: uasyncio.websocket: Websocket implementation for uasyncio.

closedby pfalconopened 2017-11-03updated 2018-02-01

Q #1: Should this be in uasyncio package at all? Upstream doesn't have
this. Pro: will be easier for people do discover (see e.g.
#148)

Q #2: This provides implements 2 ways to create a WS connections:

  1. using start_ws_server(); 2) using wrapping existing StreamReader
    and StreamWriter. History: initial prototype of course used 2). But
    the idea was "it should be like the official start_server()!!1". But
    then I though how to integrate it e.g. with Picoweb, and became clear
    that 2) is the most flixble way. So, 1) is intended to be removed.

Q #3: Uses native websocket module for read path, but has own
write path due to micropython/micropython#3396

Q #4: Requires #227
due to micropython/micropython#3394 .

2 comments
pfalcon · 2017-11-03

@dpgeorge , @peterhinch : FYI

pfalcon · 2018-02-01

Merged.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied