This commit is contained in:
MartinBraquet
2025-10-02 15:14:13 +02:00
parent 46a338b874
commit ec7c77fcf9
2 changed files with 4 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import {
CLIENT_MESSAGE_SCHEMA,
} from 'common/api/websockets'
import {IS_LOCAL} from "common/envs/constants";
import {getWebsocketUrl} from "common/api/utils";
const SWITCHBOARD = new Switchboard()
@@ -127,7 +128,7 @@ export function listen(server: HttpServer, path: string) {
const wss = new WebSocketServer({ server, path })
let deadConnectionCleaner: NodeJS.Timeout | undefined
wss.on('listening', () => {
log.info(`Web socket server listening on ${path}.`)
log.info(`Web socket server listening on ${path}. ${getWebsocketUrl()}`)
deadConnectionCleaner = setInterval(function ping() {
const now = Date.now()
for (const ws of wss.clients) {

View File

@@ -15,12 +15,14 @@ import { PrivateMessageChannel } from 'common/supabase/private-messages'
import { useAPIGetter } from 'web/hooks/use-api-getter'
import { useApiSubscription } from 'web/hooks/use-api-subscription'
import { usePersistentInMemoryState } from 'web/hooks/use-persistent-in-memory-state'
import {getWebsocketUrl} from "common/api/utils";
export function usePrivateMessages(
channelId: number,
limit: number,
userId: string
) {
console.log('getWebsocketUrl', getWebsocketUrl())
const [messages, setMessages] = usePersistentLocalState<
PrivateChatMessage[] | undefined
>(undefined, `private-messages-${channelId}-${limit}-v1`)