HN user

aperturecjs

27 karma

Open-source focused software engineer working on a app stack for local-first apps with Go and Typescript.

https://cjs.zip https://github.com/paralin https://github.com/aperturerobotics https://github.com/s4wave

Posts6
Comments12
View on HN

There are many environments that don't support WASM yet. Plus, JavaScript is a lot lighter weight for some things - particularly if you just need to register a bunch of callbacks that process data when events come in. I'm using WASM too quite a bit, though! Try out tinygo, gopherjs, or Go's built in wasm/wasi support for that.

Hi all,

This uses a "reactor" mode I added to quickjs recently which exposes quickjs as a wasi library instead of a traditional main() loop. This allows the host environment to call loop_once() to step once through the JS event loop, and poll_io() to check for I/O. This way, if there's nothing available to do (VM is idle), the Go host environment (or js) can sleep until some I/O arrives. This is a lot more efficient than having Js poll for I/O.

Check it out: https://github.com/aperturerobotics/go-quickjs-wasi-reactor

Progressive JSON 1 year ago

I previously wrote a prototype of streaming a JSON tree this way:

https://github.com/rgraphql/rgraphql

But it was too graphql-coupled and didn't really take off, even for my own projects.

But it might be worth revisiting this kind of protocol again someday, it can tag locations within a JSON response and send updates to specific fields (streaming changes).

Hi HN,

protobuf-go is a widely used binary serialization library and IDL for protobuf in Go. The upstream library leverages reflection to provide a wide variety of features which are useful in a server context.

Go is increasingly being used for resource-constrained environments like embedded (tinygo) and WebAssembly. In these environments, reflection is not always available, and when it is, it adds significant weight to the binary size.

vtprotobuf: https://github.com/planetscale/vtprotobuf - compiles static code generation for Protobufs in go, including functions to marshal, unmarshal, size, clone, messages. However, it still requires protobuf-go and the reflection-based code for the message structs.

protobuf-go-lite takes this one step further with a stripped-down version of the protobuf-go code generator modified to work without reflection and merged with vtprotobuf to provide modular features with static code generation for marshal/unmarshal, size, clone, and equal. It bundles a fork of protoc-gen-go-json for JSON support.

It has already been used (experimentally) for a reflection-free version of OpenTelemetry for Go: https://github.com/gburek-fastly/opentelemetry-proto-go/pull... as well as other projects at Aperture Robotics.

Thanks & have a great Friday!

~ Christian Stewart https://cjs.zip

Bluetooth could work! Just need to implement the Transport interface.

Peer discovery is not implemented at the moment but could easily be added (and will be soon). Here's how: any controller can resolve EstablishLinkWithPeer. A peer discovery controller could compare the list of discovered peers with the list of desired connections and initiate connections via UDP when there's a match.

Signaling is managed by the Link implementation. For UDP we use quic-go.

Hi, author here. Thanks for checking out Bifrost. The short pitch is: any protocol over any transport with seamless cross-platform (browser <-> native) communication.

Building internet applications often involves writing code that is tightly integrated with the choice of communications transport, for example, one has to make the design decision to use either WebSockets or WebRTC, and then all other design decisions are driven by that.

Bifrost aims to allow developing applications without knowing or caring which protocols are used under the hood. The app can just say "Open a stream with peer X" and whatever configured transport(s) make that happen.

I'm still working to improve the docs and new user experience, if you have any suggestions on how I can make it easier to understand, I'd greatly appreciate it!