Skip to content

How to reject a client connection? #55

@Ryniu3001

Description

@Ryniu3001

Hi,
how to reject a client connection properly? I have something like this:

SocketIoNamespace ns = mSocketIoServer.namespace("/");
    ns.on("connection", args -> {
        SocketIoSocket socket = (SocketIoSocket) args[0];
        //verify JWT token
        if (isTokenInvalid()) {
            socket.disconnect(true);
        }
    })

socket.disconnect(true) doesn't interrupt the whole connection process, so I am not sure if it's correct solution (e.g. disconnect() method clears mSockets Map inside SocketIoClient, but right after that, method onConnect() put something to that map and the rest of the connection process takes place).

Thanks for answers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions