Closed
Description
Bug Report
Current Behavior
If the close of a websocket takes a little bit of time subsequent calls to multiplex fail to send any subscription messages and close the socket immediately. See reproduction below.
Reproduction
import { interval } from "rxjs";
import { webSocket } from "rxjs/webSocket";
import { switchMap, take } from "rxjs/operators";
const socket = webSocket<any>({
url: "ws://localhost/ws"
});
interval(2_000)
.pipe(
take(2),
switchMap(id => {
return socket.multiplex(
() => `sub ${id}`,
() => `unsub ${id}`,
value => value === id
);
})
)
.subscribe({
next: _ => { },
error: err => console.error(err),
complete: () => console.log("Complete")
});
Expected behavior
A new call to multiplex should subscribe and stay open.
Environment
- 6.4.0
Metadata
Assignees
Labels
No labels
Activity