CoAPConnect / coap-pubsub-rust

MIT License
5 stars 0 forks source link

Broker set up with correct resources #4

Closed Kavan-M closed 6 months ago

Kavan-M commented 6 months ago

broker starts up so that when client runs query GET coap://address/well-known/.core is run, get appropriate response may be a hack/hardcoded at this stage well known core, ps check against draft and especially the python implementation if stuck https://github.com/jaimejim/aiocoap-pubsub-broker/blob/main/broker.py

example from python implementation: `async def main():

Create a resource tree for the CoAP server

root = resource.Site()    

root.add_resource(['.well-known', 'core'], resource.WKCResource(root.get_resources_as_linkheader))
root.add_resource(['ps'], CollectionResource(root))

# Start the CoAP server
await aiocoap.Context.create_server_context(bind=('iot.dev',5683),site=root)`
Kavan-M commented 6 months ago

The resource tree itself will be implemented later on and the initialize_topics() function has to be revamped into initialising resources.

With how the project has started, having well-known core in the handle_get() function makes more sense for now so will not be changing that. Adding hardcoded ps doesnt add value at this point since the resources are being worked on already.