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

close listener of the socket isn't called when client close #298

Closed
regseb opened this issue Apr 7, 2020 · 2 comments · Fixed by #360
Closed

close listener of the socket isn't called when client close #298

regseb opened this issue Apr 7, 2020 · 2 comments · Fixed by #360

Comments

@regseb
Copy link
Contributor

regseb commented Apr 7, 2020

Hi,

When the client closes the connection, the close listener of the socket isn't called. In the following example, the output is:

client.open()
mockServer.connection()

const { Server } = require("mock-socket");
const fakeURL = "ws://localhost:9090/jsonrpc";

const mockServer = new Server(fakeURL);
mockServer.on("connection", (socket) => {
    console.log("mockServer.connection()");

    socket.on("close", () => {
        console.log("socket.close()");
        mockServer.close();
    });
});

const client = new WebSocket(fakeURL);
client.addEventListener("open", () => {
    console.log("client.open()");
    client.close();
});
@HollPapazian
Copy link

I have same issue.

@Atrue
Copy link
Collaborator

Atrue commented May 25, 2022

Fixed in 9.1.4

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

Successfully merging a pull request may close this issue.

3 participants