Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates #67
This pull requests adds possibility to use
centrifuge-go
in browser using compilation to WebAssembly. The implementation here is an adapted code from https://github.com/nhooyr/websocket which supports WASM env for some time already. PR contains a simple example that demonstrates howcentrifuge-go
andwasm
can be used together to build a browser app.The example shown in the PR weights 12 MB when using standard Go compiler. Which is quite sad. And this makes me skeptical a bit about the idea - not sure whether someone wants to put file of this size to the browser app.
For Tinygo the situation is quite bad at the moment:
github.com/segmentio/encoding@v0.3.5/json/reflect.go:12:23: ArrayOf not declared by package reflect
- may be fixed by switching to stdlib JSON and using build tags in protocol package or when mapstructure requires MapOf and friends tinygo-org/tinygo#2115 solved(reflect.Type).PkgPath()
- Implement the PkgPath() method on reflect.Type tinygo-org/tinygo#2668Uncaught (in promise) LinkError: WebAssembly.instantiate(): Import #13 module="env" function="time.stopTimer" error: function import requires a callable
Tinygo could help reduce 12 MB to ~3 MB when all the issues mentioned above solved.