Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: Use the events WebSocket API #6717

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

PavelJankoski
Copy link
Contributor

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

  1. Login in the console.
  2. Go to a details page consisting live data, ex. /console/applications/:appId, /console/gateways/:gatewayid etc.
  3. Check if the fetched data is correct and in real time.
  4. (Extra) Check in Developers console -> Network tab if we send/receive data correctly via the web socket.

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

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • The steps/process to test this feature are clearly explained including testing for regressions.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@PavelJankoski PavelJankoski added c/console This is related to the Console ui/web This is related to a web interface labels Nov 20, 2023
@PavelJankoski PavelJankoski self-assigned this Nov 20, 2023
@github-actions github-actions bot removed the c/console This is related to the Console label Nov 20, 2023
@PavelJankoski PavelJankoski changed the title console: Replaced server side events with single socket connection us… console: Use the events WebSocket API Nov 20, 2023
Copy link
Contributor

@kschiffer kschiffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure your pre-commit hooks are installed correctly. Your commit message is too long (72 characters max iirc) and it also uses an end-of-sentence period.

CHANGELOG.md Show resolved Hide resolved
Co-authored-by: Kevin Schiffer <[email protected]>
@PavelJankoski PavelJankoski merged commit a540687 into v3.28 Nov 21, 2023
7 of 13 checks passed
@PavelJankoski PavelJankoski deleted the feature/3943-use-websocket-api branch November 21, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui/web This is related to a web interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants