-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection time role reversal for CoAP-over-WS #311
Comments
There are a few possible things to do (provided you have installed aiocoap with all extras):
|
I checked the server.py and slightly adapted client for calling coap+ws already. This worked immediately and the info and debug on the server window
show that first the websocket connection was opened and then used for the coap messages, starting with the mandatory csm message.
When the client script finished, the websocket connection was closed.
INFO:websockets.server:server listening on [::]:8683
INFO:websockets.server:server listening on 0.0.0.0:8683
DEBUG:coap-server:Server ready to receive requests
..
INFO:websockets.server:connection open
DEBUG:coap-server:Sending message: <aiocoap.Message at 0x7fa0f1d543d0: no mtype, 7.01 Csm (no MID, empty token) remote None, 2 option(s)>
DEBUG:coap-server:Sending message: <aiocoap.Message at 0x7fa0f1d561a0: no mtype, 2.05 Content (no MID, token d927) remote <WSRemote at 0x7fa0f1d55ba0, hostinfo 127.0.0.1:46710, local localhost:8683>, 1 option(s), 123 byte(s) payload>
DEBUG:coap-server:Sending message: <aiocoap.Message at 0x7fa0f1d565f0: no mtype, 2.05 Content (no MID, token d928) remote <WSRemote at 0x7fa0f1d55ba0, hostinfo 127.0.0.1:46710, local localhost:8683>, 16 byte(s) payload>
..
INFO:websockets.server:connection closed
What I am look for now, is how the websocket server side may act as coap client, sending requests using the established websocket connection.
The documentation of the transport.ws module says:
.. Requests to a CoAP-over-WS client can be made by assigning the remote to an outgoing request.
How can this statement be implemented?
There is more background information needed or even the server.py example needed some lines of extensions.
Von: chrysn ***@***.***>
Gesendet: Dienstag, 18. Juli 2023 10:08
An: chrysn/aiocoap ***@***.***>
Cc: Ernst Joachim, SBC-SAS-RCS ***@***.***>; Author ***@***.***>
Betreff: Re: [chrysn/aiocoap] Is there an example of CoAP over WS? (Issue #311)
There are a few possible things to do (provided you have installed aiocoap with all extras):
* Run the ./server.py example in one terminal. Then, in a different terminal, run aiocoap-client coap+ws://localhost:8683/.well-known/core -- it's really just another protocol (like coap+tcp), and the server listens to all by default, with the one documented exception of not listening on port 80 because that's privileged.
* I'm running some public services around https://coap.amsuess.com/, all of which are also accessible via coap+ws. For example, try coap+ws://demo.coap.amsuess.com/.well-known/core or coap+ws://rd.coap.amsuess.com/.well-known/core.
* The verdigris demo at https://chrysn.gitlab.io/verdigris/ runs in the browser, and uses coap+ws as intended. When you go to the Color Server tab, you can discover the color resources at coap+ws://rd.coap.amsuess.com/resource-lookup/ from aiocoap (or open the Color Client in another tab to switch the first tab's thumbnail color).
—
Reply to this email directly, view it on GitHub<#311 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZ4BYEROFEZDK4JGOLKVV2TXQY753ANCNFSM6AAAAAA2N4PCNY>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
This is a rather exotic application (and thus not suitable for the server.py minimal example), but there is an example in aiocoap.cli.rd around how proxy_active is used to store remotes, and how in apply_redirection it is fed into a proxying step. I'm a bit curious though: In my view of the CoAP architecture, this is predominantly used in reverse proxying. How do you set up the reverse proxy if it is not a resource directory (whose implementation is the example I gave)? |
I'd like to give you more insight into the project we plan to do, but needed a private channel due to confidentiality.
BR
Joachim
Von: chrysn ***@***.***>
Gesendet: Dienstag, 18. Juli 2023 22:56
An: chrysn/aiocoap ***@***.***>
Cc: Ernst Joachim, SBC-SAS-RCS ***@***.***>; Author ***@***.***>
Betreff: Re: [chrysn/aiocoap] Is there an example of CoAP over WS? (Issue #311)
This is a rather exotic application (and thus not suitable for the server.py minimal example), but there is an example in aiocoap.cli.rd around how proxy_active is used to store remotes, and how in apply_redirection it is fed into a proxying step.
I'm a bit curious though: In my view of the CoAP architecture, this is predominantly used in reverse proxying. How do you set up the reverse proxy if it is not a resource directory (whose implementation is the example I gave)?
—
Reply to this email directly, view it on GitHub<#311 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZ4BYEVMRCJNJLSQMEAR2SLXQ3Z47ANCNFSM6AAAAAA2N4PCNY>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
It's fundamentally possible to assign a remote through which no request has been received, but it would need some interfaces aiocoap is currently not exposing. The How and Where will depend on general use cases Please contact me at christian@amsuess.com to check whether we can generalize your specific use case into something that can be added and documented in aiocoap. (That address is also the general entry point for professional services around aiocoap, which should ease managing confidentiality concerns.) |
We would like to use CoAP over WS.
Is there a simple example availabe showing how the WS-client opens a websocket connection and then the WS-server side acts as
CoAP client and sends a CoAP request to the original client.
There are some remarks on that in the doc but it is not clear how to do it.
Best Regards
Joachim
The text was updated successfully, but these errors were encountered: