Skip to content

Connect to service bus via WebSockets #353

@MikDal002

Description

@MikDal002

Hello, I am looking for a way to connect to the service bus via web sockets. I wasn't able to make qpid-proton-c working for me. I found that azure-iot-c works over WS with IoT Hub, which brought me here. Unfortunately, I can't found connection parameters that I should provide to the "websocket_example" example. Of course, I filled IOT_HUB_HOST with "dev-myservicebusname.servicebus.windows.net", into IOT_HUB_DEVICE_NAME i wrote SharedAccessKeyName from Service Bus, into IOT_HUB_DEVICE_KEY.

I replaced authorization method to avoid using certificates:

//(void)xio_setoption(ws_io, "TrustedCerts", iothub_certs); <- that was originally in the example
SASL_PLAIN_CONFIG sasl_plain_config = { IOT_HUB_DEVICE_NAME, IOT_HUB_DEVICE_KEY, NULL };
SASL_MECHANISM_HANDLE sasl_mechanism_handle = saslmechanism_create(saslmssbcbs_get_interface(),  &sasl_plain_confi

At this moment I completely don't know what I should write in place of

  • ws_io_config.resource_name = "/$iothub/websocket";,
  • STRING_concat(scope_string, IOT_HUB_HOST "/devices/" IOT_HUB_DEVICE_NAME);
  • (void)cbs_put_token_async(cbs, "servicebus.windows.net:sastoken", IOT_HUB_HOST "/devices/" IOT_HUB_DEVICE_NAME, STRING_c_str(sas_token), on_cbs_put_token_complete, cbs);

Errors I receive:

Error: Time:Wed Oct 21 13:45:04 2020 File:/mnt/c/Users/mikdal/source/repos/azure-iot-sdk-c/c-utility/src/uws_client.c Func:on_underlying_io_bytes_received Line:1183 Bad status (400) received in WebSocket Upgrade response
Error: Time:Wed Oct 21 13:45:04 2020 File:/mnt/c/Users/mikdal/source/repos/azure-iot-sdk-c/c-utility/src/wsio.c Func:internal_close Line:149 wsio_close when not open.
Error: Time:Wed Oct 21 13:45:04 2020 File:/mnt/c/Users/mikdal/source/repos/azure-iot-sdk-c/uamqp/src/amqp_management.c Func:amqp_management_close Line:1020 AMQP management instance not open
CBS instance open failed.
Error: Time:Wed Oct 21 13:45:04 2020 File:/mnt/c/Users/mikdal/source/repos/azure-iot-sdk-c/c-utility/adapters/tlsio_openssl.c Func:decode_ssl_received_bytes Line:798 SSL channel closed in decode_ssl_received_bytes.
Error: Time:Wed Oct 21 13:45:04 2020 File:/mnt/c/Users/mikdal/source/repos/azure-iot-sdk-c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_bytes_received Line:847 Error in decode_ssl_received_bytes.

I tried many different combinations of: IOT_HUB_HOST and queue name but with no luck. Additionally, I completely don't know where I could find any clue about useful endpoints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions