go-stomp / stomp

Go language library for STOMP protocol
Apache License 2.0
318 stars 96 forks source link

Getting non-standard headers from the CONNECT response #82

Closed SoMuchForSubtlety closed 4 years ago

SoMuchForSubtlety commented 4 years ago

I need a custom header from the connect response and I saw this is already documented in a TODO.

// TODO(jpj): make any non-standard headers in the CONNECTED
// frame available. This could be implemented as:
// (a) a callback function supplied as an option; or
// (b) a property of the Conn structure (eg CustomHeaders)
// Neither options are particularly elegant, so wait until
// there is a real need for this.

I would be happy to contribute the code for this in either of the two listed options.

I also created a shim that turns a websocket connection into an io.ReadWriteCloser so I can connect to Spring STOMP servers. I'm happy to also create a PR for that if it's not considered out of scope.

cameronelliott commented 4 years ago

Sorry for commenting on closed issue, but I cannot at-sign-mention SoMuch... in new issues.

@SoMuchForSubtlety , if you have a shim/possible-PR for using go-stomp with either ws: or wss: websockets, I personally would love to see that! I am very very interested in being able to use this package with stomp over websockets, as it is available in RabbitMQ and ActiveMQ (both non-ssl and ssl (ws,wss)).

I suppose the main question is, would the maintainers like to see the PR for merging, like, does it fit the vision??? But, I would be thrilled to see ws: or wss: support bolted on one way or another. (webstomp-support)

@worg Could or should @SoMuchForSubtlety submit a PR with the shim mentioned for discussion???

-Cameron

cameronelliott commented 4 years ago

I may also explore what would be needed for the included lightweight server to support ws and/or wss. (websocket-stomp and ssl/tls websocket-stomp)

SoMuchForSubtlety commented 4 years ago

This is my websocket ReadWriteCloser. https://gist.github.com/SoMuchForSubtlety/0c32f6c9ad0005f7775f36d2a0da8c72

I will submit a PR when I have time to write tests for it.