News for hackers. Stuff that matters.
Re:Open Sourcing the Stupid-Simple Messaging Protocol by thom_nic on Thursday September 10, 2015 @11:33AM (#10198649)
Also, since SSMP is completely text-based, does that mean the only way to send binary data is to base64-encode it? Or does it support a length header or chunking similar to HTTP?
Re:Open Sourcing the Stupid-Simple Messaging Protocol by dsr_ on Thursday September 10, 2015 @11:37AM (#10198671)
It's slightly worse than that: a payload can be any 8-bit data... except a LF character. Which is to say, you will need to either escape or quote it in some way, which is to say you are on your own.

It might have been cleaner to specify base64 encoding or length-prefaced payloads (say, 16 bit int preface indicating length in bytes). As it is, you are on your own.

Re:Open Sourcing the Stupid-Simple Messaging Protocol by vonsnowman on Thursday September 10, 2015 @11:37AM (#10198675)
base64 is the preferred way but any 8-bit encoding that doesn't use LF would also work.

There is no support for a length header or chunking as SSMP is designed with small messages in mind.

Re:Open Sourcing the Stupid-Simple Messaging Protocol by teacup50 on Thursday September 10, 2015 @01:40PM (#10199418)
Why wouldn't you just include a length field on strings/bytes, allowing the protocol to be "binary clean" and avoid the base64 problem entirely?

This is one of the most annoying things about XMPP (even sending contact photos hits this!), so if replacing XMPP ...

Re:Open Sourcing the Stupid-Simple Messaging Protocol by vonsnowman on Thursday September 10, 2015 @03:10PM (#10199926)
A big advantage of LF-delimited over length-prefixed messages is netcat/telnet-friendliness. That was more valuable to us than being binary-clean as our use cases do not involve sending large binary messages.
Re:Open Sourcing the Stupid-Simple Messaging Protocol by mjevans on Thursday September 10, 2015 @05:08PM (#10200573)
I think you might want to make a distinction between a stream packet and a completed message.

If you're going for telnet compatibility then you'll want to terminate packets in CR+LF, but possibly expect to see only CR or LF from the client (ASCII mode).

Your stream could either be stateful (a message is always sent complete and in order, even if it takes multiple stream packets) or stateless* (different messages might have stream packets consecutively).

It would be more future proof if you started with a message grammar and then defined your protocol on top of that.

Re:Open Sourcing the Stupid-Simple Messaging Protocol by teacup50 on Thursday September 10, 2015 @05:35PM (#10200705)
A binary-friendly client would be a hundred lines of code at most, versus inefficiency for a pretty standard protocol use-case forever.
Re:Open Sourcing the Stupid-Simple Messaging Protocol by IshKebab on Friday September 11, 2015 @03:12AM (#10202370)
You know you could have a length-prefix and a new-line. Best of both worlds.
Re:Open Sourcing the Stupid-Simple Messaging Protocol by dsr_ on Thursday September 10, 2015 @11:44AM (#10198704)
I suggest that you call it the default in your spec and include it in your reference implementation, then.