arduino-create-agent
arduino-create-agent copied to clipboard
feat(ws): add `ws` endpoint
Motivation
Currently, the agent seems to be using https://github.com/googollee/go-socket.io which (besides being archived) implements the v1.4 of Socket.IO client (it looks like it's compatible with 2.x as well for some reason).
Now, the current state of the JS library for communicating with the agent is pretty bad from multiple points of view (from a lack of documentation to a lack of types, to an annoying number of bugs, issues and gotchas in the current implementation).
Now, the issue is that in order to communicate with the agent we're forced to use the v2 implementation (again, because server v2 seems to be working somehow, otherwise we'd have to go v1.x - see https://socket.io/docs/v4/client-installation/#version-compatibility), and that means our hands are tied in various places:
- It doesn't have first class support for TypeScript
- It's on life support (last release - https://github.com/socketio/socket.io/releases/tag/2.5.0)
- It doesn't tree shake, which means the users have to download the whole bundle (which isn't small by any means - https://bundlephobia.com/package/[email protected]) Additionally, the implementation is not a real websocket server as stated by [Socket.IO themselves]https://socket.io/docs/v4/#what-socketio-is-not) and that makes it incompatible with [WebSocket API]((https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) forcing us to stay on v2 with the aforementioned drawbacks.
- What kind of change does this PR introduce?
Feature
- What is the current behavior?
- What is the new behavior?
- Does this PR introduce a breaking change?
- Other information:
Codecov Report
Attention: Patch coverage is 0% with 59 lines in your changes missing coverage. Please review.
Project coverage is 19.78%. Comparing base (
1b94ccc) to head (3e691cd).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| main.go | 0.00% | 59 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1015 +/- ##
==========================================
- Coverage 20.14% 19.78% -0.36%
==========================================
Files 42 42
Lines 3222 3280 +58
==========================================
Hits 649 649
- Misses 2488 2546 +58
Partials 85 85
| Flag | Coverage Δ | |
|---|---|---|
| unit | 19.78% <0.00%> (-0.36%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.