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

Accept StompCommandListener constructor or instance when building Sessions #14

Closed
pcan opened this issue Mar 29, 2018 · 0 comments
Closed

Comments

@pcan
Copy link
Owner

pcan commented Mar 29, 2018

The createStompServerSession and createStompClientSession should also accept a StompCommandListener constructor in order to build a listener that accept a reference to the newly created session. With this enhancement the following code will be possible:

class MyListener implements StompClientCommandListener {

    constructor(private readonly session: StompServerSessionLayer) {
    }

    connect(headers?: StompHeaders): void {
        this.session.connected({ version: '1.2', server: 'MyServer/1.8.2' }).catch(console.error);
    }

    // other methods implemented here...
}

const session = createStompServerSession(socket, MyListener);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant