Skip to content

Commit c68ce87

Browse files
committed
Send contextJson to client SSE
1 parent 7d0470d commit c68ce87

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

packages/browser-sdk/src/sse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class AblySSEChannel {
137137
}
138138
const serializedContext = canonicalContextJSONStringify(this.context);
139139
if (serializedContext) {
140-
url.searchParams.append("context", serializedContext);
140+
url.searchParams.append("contextJson", serializedContext);
141141
}
142142

143143
this.eventSource = this.createEventSource(url.toString()) ?? null;

packages/browser-sdk/test/sse.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ describe("connection handling", () => {
110110
});
111111

112112
const url = new URL(vi.mocked(window.EventSource).mock.calls[0][0]);
113-
expect(url.searchParams.get("context")).toBe(
113+
expect(url.searchParams.get("contextJson")).toBe(
114114
JSON.stringify({ user: { id: 23 } }),
115115
);
116+
expect(url.searchParams.has("context")).toBe(false);
116117
});
117118

118119
test("enables EventSource credentials when credentials is include", async () => {

0 commit comments

Comments
 (0)