Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket Serialization error not shown #5624

Open
s4m0r4m4 opened this issue Aug 3, 2020 · 3 comments
Open

Websocket Serialization error not shown #5624

s4m0r4m4 opened this issue Aug 3, 2020 · 3 comments

Comments

@s4m0r4m4
Copy link

s4m0r4m4 commented Aug 3, 2020

Bug Report

Current Behavior
When an error is thrown/encountered in the function provided as the "serializer" in the WebsocketSubjectConfig object, this error gets silently swallowed and then the websocket connection fails.

Reproduction

Here is a stackblitz repro, except I didn't have a public websocket to test with. If you have any recommendations I'd gladly update the repro.
https://stackblitz.com/edit/angular-ivy-hxp2ht

Expected behavior
The error should make its way back to the error subscription.

Environment

  • Node v12.16.1
  • RxJS version: 6.5.5
  • Angular: 9.1.3

Possible Solution

Unknown

@s4m0r4m4
Copy link
Author

Hi I'm just checking in on this - perhaps there's a way to handle such errors that I'm not aware of?

@elpddev
Copy link

elpddev commented Nov 12, 2020

Hi @s4m0r4m4 . I'm not a maintainer, just looking. The relevant code maybe this:

In any case, you could always provide 1->1 custom serializer to the config and serialize the message before hand. What I do in those cases is for example:

function streamSend() {
  const streamFn = () => sendAction.pipe(
     map(data => serializeData(data)),
     tap(dataStr => webSocket$.next(dataStr)),
     catchError((err) =>{
        logError(err);
        return streamFn()
     })
  );
  
  return streamFn();
}

streamSend().pipe(takeUntil(...)).subscribe();

@bever1337
Copy link

Related bugs: #5312 #6848

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@s4m0r4m4 @elpddev @bever1337 and others