Details
Description
The goal of this endpoint is to give SonarQube the possibility to push events to Sonarlint clients, to notify them about a change without delay. The solution is to use Server Side Event (SSE) over http1. Sonarlint clients will subscribe to events for a list of project keys & languages, the server should send an event when needed (see SONAR-15919 and SONAR-15920 as the first two events to be implemented)
Web API endpoint & parameters:
api/sonarlint/streamEvents?projectKeys=key1,key2,key3&languages=java,python
The endpoint should be flagged as internal.
General payload used for all events:
{ event: EventName data: {-- event data payload as json here --} }
Heartbeat:
every 10s, the server will push a small payload to verify that the connexion is still alive. Any exception raised by this heartbeat will terminate the connexion on the server side.
\r flush() \n flush()
Authentication:
The endpoint should support all current authentication mechanisms: JWT token, username:password, SQ token.
Permission:
Browse permission is required on all projects in the "projectKeys" parameter.
DataCenter Edition implementation:
Each Web node holds a local collection of Sonarlint Clients that are registered on this node (should be balanced by the load balancer). When an event is broadcast to SL clients, it's also sent to all SQ Web nodes through Hazelcast, allowing them to broadcast the event to their SL clients.
Code design and packaging:
This new endpoint and the related code should be placed in a dedicated module for ServerSide Event. It should be available starting from Community Edition, meaning it's open source.
Attachments
Issue Links
- is related to
-
SONAR-15919 Add RuleSetChanged event to events streamed to SonarLint
-
- Closed
-
-
SONAR-15920 Add SettingChanged event to events streamed to SonarLint
-
- Closed
-