event-stream-debug
This commit is contained in:
parent
2b91a729bd
commit
54f114c8c9
|
@ -95,14 +95,14 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
|
||||||
loadNotifications()
|
loadNotifications()
|
||||||
|
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
const eventSource = new EventSource(`https://chat.discours.io/connect/${token}`)
|
const eventSource = new EventSource(`https://chat.discours.io/connect/?token=${token}`)
|
||||||
|
|
||||||
eventSource.onmessage = (event) => {
|
eventSource.onmessage = (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 {
|
||||||
console.log('[context.notifications] Received notification:', n)
|
|
||||||
storeNotification({
|
storeNotification({
|
||||||
kind: n.kind,
|
kind: n.kind,
|
||||||
payload: n.payload,
|
payload: n.payload,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user