question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When trying to use the directline api post retrieved websocket connection for a conversation I get failed: Error during WebSocket handshake: Unexpected response code: 403

See original GitHub issue

I am using a websocket client connection on an Angular client with rxjs

I am on localhost with not certificate so is that the issue?

After a few usages and a few refreshes the conversation wss url is not valid in the client and will emit an error. Eventually the error is: Error during WebSocket handshake: Unexpected response code: 403

Here is the rxjs code I am using:

if (this.isBrowser) {
      const subject = webSocket("wss://directline.botframework.com/v3/directline/conversations/1zRgrgUTSnkPiFuLYjSDS-5/stream?watermark=-&t=xxxxxxxxxxxxxx");
      subject.subscribe(
        msg => console.log('message received: ' + JSON.stringify(msg['activities'][0]['text'])), // Called whenever there is a message from the server.
        err => console.log('ERROR from socket ', err), // Called if at any point WebSocket API signals some kind of error.
        () => console.log('complete') // Called when connection is closed (for whatever reason).
      );
WebSocketSubject.js:91 WebSocket connection to 'wss://directline.botframework.com/v3/directline/conversations/C3A15SW4heY6WeEoKsDIZF-j/stream?watermark=-&t=xxxxxxxxxxxxxxxxxxxxxxxxx' failed: Error during WebSocket handshake: Unexpected response code: 403
_connectSocket @ WebSocketSubject.js:91
_subscribe @ WebSocketSubject.js:186
_trySubscribe @ Observable.js:42
_trySubscribe @ Subject.js:81
subscribe @ Observable.js:28
ngOnInit @ app.component.ts:58
callHook @ core.js:4726
callHooks @ core.js:4690
executeInitAndCheckHooks @ core.js:4630
refreshView @ core.js:12013
renderComponentOrTemplate @ core.js:12129
tickRootContext @ core.js:13652
detectChangesInRootView @ core.js:13686
detectChanges @ core.js:15395
tick @ core.js:43132
_loadComponent @ core.js:43182
bootstrap @ core.js:43108
(anonymous) @ core.js:42683
_moduleDoBootstrap @ core.js:42679
(anonymous) @ core.js:42634
invoke @ zone-evergreen.js:364
onInvoke @ core.js:41654
invoke @ zone-evergreen.js:363
run @ zone-evergreen.js:123
(anonymous) @ zone-evergreen.js:857
invokeTask @ zone-evergreen.js:399
onInvokeTask @ core.js:41632
invokeTask @ zone-evergreen.js:398
runTask @ zone-evergreen.js:167
drainMicroTaskQueue @ zone-evergreen.js:569
invokeTask @ zone-evergreen.js:484
invokeTask @ zone-evergreen.js:1621
globalZoneAwareCallback @ zone-evergreen.js:1647
Show 3 more frames
app.component.ts:61 ERROR from socket  Event {isTrusted: true, type: "error", target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
xtianus79commented, Jun 25, 2020

@compulim I will have to get that to you but the issue lies in the directline-stream api that is using typescript 3.5.3 which is below this parent component and is not in the range of an angular application 3.6.2 and above. I have, for now, moved onto using the api directly.

0reactions
Virtual-Joshcommented, Jul 7, 2020

closing due to inactivity/dupe

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error during WebSocket handshake: Unexpected response ...
Using directLine or Webchat with my bot After 5 minutes of using ... Error during WebSocket handshake: Unexpected response code: 403 #4071.
Read more >
Troubleshooting Azure Bot Service bots - Microsoft Learn
Direct Line 3.0 returns HTTP status code 502 when it tries to contact your bot but the request doesn't complete successfully. This error...
Read more >
Websocket error in dashboard
When opening a dashboard, the following websocket error message appears: A websocket error has occurred. Websocket connection was closed or ...
Read more >
Unanswered 'direct-line-botframework' Questions
I'm trying to add a Site to my DirectLine channel in my Azure Bot Registration via the REST APIs. When I perform a...
Read more >
Windows Server 2019 Error During Websocket Handshake
When trying to use the directline api post retrieved websocket connection for a conversation I get failed: Error during WebSocket handshake: Unexpected.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found