diff --git a/docker/nginx.conf b/docker/nginx.conf index 43aa949a5..9f0ade838 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -82,6 +82,19 @@ http { proxy_set_header Host $host; } + location /bb-client/socket.io { + rewrite ^/bb-client(.*)$ $1 break; + proxy_pass http://billboard-client:8083/socket.io; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect off; + proxy_set_header Host $host; + } + } } \ No newline at end of file diff --git a/packages/billboard-client/src/service/viewerService/viewerService.ts b/packages/billboard-client/src/service/viewerService/viewerService.ts index 2191b3c39..9a10ca317 100644 --- a/packages/billboard-client/src/service/viewerService/viewerService.ts +++ b/packages/billboard-client/src/service/viewerService/viewerService.ts @@ -2,6 +2,7 @@ import { Message } from 'dm3-lib-messaging'; import http from 'http'; import { Server, Socket } from 'socket.io'; import { IViewerService } from './IViewerService'; +import { logDebug } from 'dm3-lib-shared'; /** * Creates and returns an instance of a viewer service that manages viewer connections and message broadcasting. @@ -20,6 +21,12 @@ export function ViewerService(httpServer: http.Server): IViewerService { const connections: Map = new Map(); const addConnection = (connection: Socket) => { + logDebug({ + text: '[ViewerService] connect', + id: connection.id, + connectionsSize: connections.size, + }); + //When the socket disconnects we wan't them no longer in our viewers List connection.on('disconnect', () => { removeConnection(connection); @@ -28,10 +35,19 @@ export function ViewerService(httpServer: http.Server): IViewerService { }; const removeConnection = (connection: Socket) => { + logDebug({ + text: '[ViewerService] disconnect', + id: connection.id, + connectionsSize: connections.size, + }); connections.delete(connection.id); }; const getViewerCount = () => { + logDebug({ + text: '[ViewerService] getViewerCount', + connectionsSize: connections.size, + }); return connections.size; }; diff --git a/packages/billboard-widget/package.json b/packages/billboard-widget/package.json index 742217626..e63c0b972 100644 --- a/packages/billboard-widget/package.json +++ b/packages/billboard-widget/package.json @@ -1,6 +1,6 @@ { "name": "dm3-billboard-widget", - "version": "0.3.0", + "version": "0.3.1", "files": [ "dist" ], diff --git a/packages/lib/delivery/src/UserProfile.ts b/packages/lib/delivery/src/UserProfile.ts index 71e4bd579..b5e57459f 100644 --- a/packages/lib/delivery/src/UserProfile.ts +++ b/packages/lib/delivery/src/UserProfile.ts @@ -38,12 +38,10 @@ export async function submitUserProfile( send: (socketId: string) => void, ): Promise { const account = normalizeEnsName(ensName); - console.log('1', account, signedUserProfile); if (!(await checkUserProfile(provider, signedUserProfile, account))) { throw Error('Signature invalid.'); } - console.log('2', process.env.DISABLE_SESSION_CHECK); //TODO: remvoe DISABLE_SESSION_CHECK // DISABLE_SESSION_CHECK is a special solution for ETH Prague if ( @@ -52,7 +50,6 @@ export async function submitUserProfile( ) { throw Error('Profile exists already'); } - console.log('3'); const session: Session = { account, signedUserProfile, @@ -60,17 +57,15 @@ export async function submitUserProfile( createdAt: new Date().getTime(), profileExtension: getDefaultProfileExtension(), }; - console.log('4', session); await setSession(account.toLocaleLowerCase(), session); - console.log('5'); await handlePendingConversations( account, getSession, getPendingConversations, send, ); - console.log('6'); + return session.token; }