An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/thejerf/sijsop

Package sijsop provides a SImple JSOn Protocol that is easily parsed by numerous languages, guided by experience in multiple languages. This protocol has one of the best bang-for-the-buck ratios you can find for any protocol. It is so easy to implement that you can easily implement this for another language, yet as powerful as the JSON processing in your language. There's better protocols on every other dimension, for compactness, efficiency, safety, etc., but when you just want to bash out a line protocol quickly and those other concerns aren't all that pressing, this is a pretty decent choice. It also has the advantage of not committing you very hard to a particular implementation, because any network engineer can bang out an implementation of this in another language in a couple of hours. This protocol is defined in terms of messages, which must implement sijsop.Message. This involves writing two static class methods, one which declares a string which uniquely identifies this type for a given Definition, and one which simply returns a new instance of the given type. These must be defined on the pointer receiver for the type, because we must be able to modify the values for this code to work. Once you have a Definition, you can use it to wrap a Reader, which will permit you to receive messages, a Writer, which will permit you to send them, or a ReadWriter, which allows for bidirectional communication. sijsop is careful to never read more than the next message, so it is quite legal using this protocol to send some message that indicates some concrete length, then use the underlying Reader/Writer/ReadWriter directly, then smoothly resume using the sijsop protocol. See the example file shown below. The protocol is a message-based protocol which works as follows: Commentary: I've often used variants of this protocol that used just the JSON portion, but I found myself repeatedly having to parse the JSON once for the type, and then again with the right type. Giving statically-typed languages a chance to pick the type out in advance helps with efficiency. Static languages can just ignore than field if they like. Everything else is left up to the next layer. Protocols that are rigid about message order are easy. Protocols that need to match requests to responses are responsible for their own next-higher-level mapping. This example demonstrates transferring a binary file using the sijsop protocol, with the file transferred out-of-band. Left is going to read a file and send it to Right, who will acknowledge it.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/thejerf/sijsop
License: MIT
Latest release: about 6 years ago
First release: about 7 years ago
Namespace: github.com/thejerf
Stars: 12 on GitHub
Forks: 1 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 26 days ago

    Loading...
    Readme
    Loading...