I am using the Pub-Sub service to send/receive messages between client and server.
using JS version on client as well as server
Client
"@azure/web-pubsub-client": "^1.0.0-beta.3",
Server
"@azure/web-pubsub": "^1.1.1",
"@azure/web-pubsub-express": "^1.0.4",
Once I create client and start sending message to group OR send message to server, it works well.
I have configured URL in Resource so that I am able to receive custom messages to my middleware.
The moment I send message to server using
await client.sendEvent('message', 'Client is ready', 'text', {fireAndForget: true});
and after that if I send any message to group, it takes approx 80-85 seconds to receive other group members.
No console error on client side or server side.
But on LiveTraceTool, I can see one exception.
{"time":"2023-06-14T07:30:54.7972607Z","logLevel":"Warning","eventName":"HttpInvocationFailed","message":"Failed invoking 'https://5dd1b8bbaa56.ngrok.app/eventhandler?hub=captionmeeting&event=x' for 'hub:captionmeeting,event:message,type:user,category:messages,requestType:UserEvent'.","exception":"The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing."}
Any idea about this particular error?
Once I receive this error on tool, after that it works smoothly and no problem occurs afterwards.
Is there anything which I am missing ?
Middleware code (using express library)
let handler = new WebPubSubEventHandler(HUB_NAME, {
path: '/eventhandler', // Exposes an endpoint
onConnected: async (req) => {
console.log(`${req.context.userId} connected`);
},
onDisconnected: async (req) => {
console.log(req)
},
// This handler function will handle user system
handleUserEvent: async (req, res) => {
if (req.context.eventName === "message") {
console.log(`Received message: ${req.data}`);
}
}
})
Region hosted: Germany West Central
Hub setting
Any help will be appreciated!
Thanks