Hey guys, I’ve implemented a coroutine-based multiplatform STOMP client over websockets (JVM/Browser/NodeJS). I would love to hear any feedback! (issues and PRs are welcome)
09/13/2020, 10:20 PM
How's this different from ktor client?
09/13/2020, 10:21 PM
Ktor doesn’t have a STOMP protocol implementation as far as I know. Or maybe I missed it? One of the possible backing websocket implementations of Krossbow is actually Ktor, but STOMP is a protocol built on top of websockets
09/13/2020, 10:34 PM
I see, thanks for explaining it.
09/14/2020, 5:44 PM
@Joffrey this is going off of my memory but I believe @jessewilson once told me that STOMP is not built on top of websockets and it has nothing to do with websockets in general. Maybe that's just me being pedantic, but I know that clarification helped my team decide to ditch stomp over WS.
09/14/2020, 7:19 PM
What’s STOMP over websockets do for me that I can’t get with web sockets alone?
09/14/2020, 7:52 PM
@Colton Idle STOMP is a frame based protocol that technically could be implemented on a plain TCP connection, yes. However, websockets already bring a frame structure to a TCP connection, and also they help use sockets on the web via HTTP upgrade, because you can’t just open a socket to a random port on a server you don’t own. So when you want to use STOMP in a browser, you pretty much have to rely on websockets (or an emulation of them like SockJS).
@jessewilson it’s an application level messaging protocol, it brings you more structure and features than raw websockets. Destinations (routes), headers, subscriptions, receipts, transactions... All of which could of course be implemented ad hoc, but when you use a standard you usually find libraries already implemented for you, and compatible server implementations. For instance Spring already supports STOMP out of the box, and it’s the first thing you find when you look for websockets in Spring.
We could ask the same question for why use HTTP, it technically brings nothing you can’t do with TCP, because you could literally reinvent it yourself in a different way. It’s just higher level and standard.