Ich kann keine Verbindung zu Azure PubSub Group aus meiner Streamlit -App herstellenPython

Python-Programme
Anonymous
 Ich kann keine Verbindung zu Azure PubSub Group aus meiner Streamlit -App herstellen

Post by Anonymous »

Ich habe eine Stromschlange mit Verbindungsschaltfläche. Wenn Sie auf die Schaltfläche Verbinden klicken, sollte eine Verbindung zu Azure PubSub erstellt werden. Aber ich bekomme den folgenden Fehler.
SendMessageError: Failed to send message. < /code>
Der Streamlit -Code ist < /p>
import azure.messaging.webpubsubclient
import streamlit
from azure.messaging.webpubsubclient import WebPubSubClient
from azure.messaging.webpubsubclient.models import CallbackType, WebPubSubDataType
if streamlit.button("Connect"):
client = WebPubSubClient("wss://blablabla.webpubsub.azure.com/client/hubs/Hub?access_token=access")
with client:
# The client can join/leave groups, send/receive messages to and from those groups all in real-time
group_name = "group1"
client.subscribe(CallbackType.GROUP_MESSAGE, lambda e: print(f"Received message: {e.data}"))
# ...continues the code snippet from above
client.is_connected()
client.join_group(group_name)
# Send a message to a joined group
client.send_to_group(group_name, "hello world", WebPubSubDataType.TEXT)

# In the Console tab of your developer tools found in your browser, you should see the message printed there.
# A client needs to join the group it wishes to receive messages from
# client.join_group(group_name)
< /code>
Im Azure -Portal sehe ich auch keine Hub oder Gruppe. Muss ich etwas im Portal ändern? So beheben Sie es.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post