WebSocket client (on WiPy, ESP8266 or Unix) ?
WebSocket client (on WiPy, ESP8266 or Unix) ?
Did somebody work on / knows about WebSocket client code for WiPy, ESP8266 or the MicroPython Unix version?
Context is: I'd like to connect to SAP HCP IoT Services (I put a https version for doing so at https://github.com/SAP/iot-starterkit/b ... ary_get.py ) but now aim to work with wss which would give us better bandwidth efficiency and a bi-directional channel.
Maybe there is also a chance to use the https://github.com/liris/websocket-client lib that works well with standard Python?
best regards
Ralf
Context is: I'd like to connect to SAP HCP IoT Services (I put a https version for doing so at https://github.com/SAP/iot-starterkit/b ... ary_get.py ) but now aim to work with wss which would give us better bandwidth efficiency and a bi-directional channel.
Maybe there is also a chance to use the https://github.com/liris/websocket-client lib that works well with standard Python?
best regards
Ralf
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
Meanwhile I did some further checks.
- There is a "built-in" websocket module (that pfalcon wrote) - is there any further info about its usage?
- I checked the liris websocket-client lib - unfortunately it has a number of dependencies (e.g. six.py), so it might be easier to just start from e.g. a simple Arduino websocket lib like https://github.com/MORA99/Stokerbot/tre ... cketClient ? (I successfully used it with a RedBear CC3200 based module and Energia).
Any feedback is highly welcome
Ralf
- There is a "built-in" websocket module (that pfalcon wrote) - is there any further info about its usage?
- I checked the liris websocket-client lib - unfortunately it has a number of dependencies (e.g. six.py), so it might be easier to just start from e.g. a simple Arduino websocket lib like https://github.com/MORA99/Stokerbot/tre ... cketClient ? (I successfully used it with a RedBear CC3200 based module and Energia).
Any feedback is highly welcome
Ralf
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
It's in "provisional" mode, and not documented, because details of the interface may change. It's otherwise works in a pretty natural way, and you got as far as the above, you won't have problem to figure out how to use it, following ESP8266 webrepl code which uses it. Note that by default that works in server mode, you may need to check client support (feel free to report any issues on github). Pure-Python client-side counterpart can be found in webrepl_cli.py from webrepl repo on github.ubiq_01 wrote: - There is a "built-in" websocket module (that pfalcon wrote) - is there any further info about its usage?
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
Many thanks! That helps!
best regards
Ralf
best regards
Ralf
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
I have a 1st Websocket+TLS = wss:// interaction with the SAP IoT Services up and running on my desktop. https://twitter.com/_rac01/status/773090983630233601
I can receive data "pushed" to a device - and have to check the "upstream" (where the server complains about "the frame not being masked" still. I'll try on a WiPy next.
best regards
Ralf
I can receive data "pushed" to a device - and have to check the "upstream" (where the server complains about "the frame not being masked" still. I'll try on a WiPy next.
best regards
Ralf
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
Meanwhile there is a 1st interaction on the WiPy as well.
https://twitter.com/_rac01/status/773133357874024448
best regards
Ralf
https://twitter.com/_rac01/status/773133357874024448
best regards
Ralf
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
It's working now! https://twitter.com/_rac01/status/773427887701712896
Many thanks to pfalcon for the support and https://github.com/micropython/webrepl as a starting point.
For my purposes I had to modify:
- add OAuth authentication in wss setup
- use text (instead of binary) frames
- WebSocket masking mechanism for client => server communication
Great to have a way to use wss:// with WiPy and ESP8266 (in my case for IoT scenarios) now as well!
best regards
Ralf
Many thanks to pfalcon for the support and https://github.com/micropython/webrepl as a starting point.
For my purposes I had to modify:
- add OAuth authentication in wss setup
- use text (instead of binary) frames
- WebSocket masking mechanism for client => server communication
Great to have a way to use wss:// with WiPy and ESP8266 (in my case for IoT scenarios) now as well!
best regards
Ralf
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
It would be great if you guys with web programming experience wrote tutorials for n00bs like myself. My background is in hardware design, device drivers and assembler so internet coding presents a steep learning curve Surely I'm not alone in finding it a struggle?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
That's quite understood.
As one resource I can refer to the SAP IoT Starterkit https://github.com/SAP/iot-starterkit that combines step by step instructions for setting up the Cloud part (which is in a free trial environment) with several (also Python) code snippets and ready-to-run applications. Some code like https://github.com/SAP/iot-starterkit/t ... y_transfer have been done and tested with exactly components as small as the WiPy or ESP8266 / Micropython in mind.
best regards
Ralf
As one resource I can refer to the SAP IoT Starterkit https://github.com/SAP/iot-starterkit that combines step by step instructions for setting up the Cloud part (which is in a free trial environment) with several (also Python) code snippets and ready-to-run applications. Some code like https://github.com/SAP/iot-starterkit/t ... y_transfer have been done and tested with exactly components as small as the WiPy or ESP8266 / Micropython in mind.
best regards
Ralf
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: WebSocket client (on WiPy, ESP8266 or Unix) ?
Thank you, those links look promising. I will study them properly soon. I'm keen to get MQTT running with SSL but haven't got my head round the certificate stuff...
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.