console: Use the events WebSocket API #6717
Merged
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.
Summary
This PR replaces server side events with single socket connection using WebSocket API
Changes
Refactored streaming module of the JS SDK. Now we are using only
/api/v3/console/internal/events/
endpoint for fetching events for all entities, as opposed to using multiple per entity type. Using the native WebSocket API.Testing
/console/applications/:appId
,/console/gateways/:gatewayid
etc.Notes for Reviewers
Initialy like a temporary fix to test this(until it is being implemented, I already contacted @adriansmares), you need to hardcode this line into
pkg/webui/csp.go
file and before line 108 so you could establish a connection with the web socket:csp.ConnectionSource = append(csp.ConnectionSource, "wss://tti.staging1.cloud.thethings.industries/api/v3/console/internal/events/", "ws://localhost:1885/api/v3/console/internal/events/", "ws://localhost:8080/api/v3/console/internal/events/")
Checklist
README.md
for the chosen target branch.CHANGELOG.md
.CONTRIBUTING.md
, there are no fixup commits left.