event-stream-debug2
This commit is contained in:
parent
54f114c8c9
commit
89d2f638ca
|
@ -98,8 +98,8 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
|
||||||
const eventSource = new EventSource(`https://chat.discours.io/connect/?token=${token}`)
|
const eventSource = new EventSource(`https://chat.discours.io/connect/?token=${token}`)
|
||||||
|
|
||||||
eventSource.onmessage = (event) => {
|
eventSource.onmessage = (event) => {
|
||||||
|
console.log('[context.notifications] Received event:', event)
|
||||||
const n: { kind: string; payload: any } = JSON.parse(event.data)
|
const n: { kind: string; payload: any } = JSON.parse(event.data)
|
||||||
console.log('[context.notifications] Received notification:', n)
|
|
||||||
if (n.kind === 'new_message') {
|
if (n.kind === 'new_message') {
|
||||||
messageHandler()(n.payload)
|
messageHandler()(n.payload)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user