Skip to content

Commit

Permalink
event stream: include realtime session ID header
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Jan 3, 2024
1 parent 79d3b4c commit c39eed3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions linkedin_messaging/linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,18 @@ async def _fire(self, payload_key: str, event: Any):
async def _listen_to_event_stream(self):
logging.info("Starting event stream listener")

headers = {
"accept": "text/event-stream",
"connection": "keep-alive",
"content-type": "text/event-stream",
**REQUEST_HEADERS,
}
if self._realtime_sesion_id:
headers["X-Li-Realtime-Session"] = self._realtime_sesion_id

async with self.session.get(
REALTIME_CONNECT_URL,
headers={
"accept": "text/event-stream",
"connection": "keep-alive",
"content-type": "text/event-stream",
**REQUEST_HEADERS,
},
headers=headers,
) as resp:
if resp.status != 200:
raise TooManyRequestsError(f"Failed to connect. Status {resp.status}.")
Expand Down

0 comments on commit c39eed3

Please sign in to comment.