Skip to content

Commit

Permalink
feat: frameId to manage frames
Browse files Browse the repository at this point in the history
 - when used in server it represents the process
 - send creates empty data object if does not exist
  • Loading branch information
frankpagan committed Oct 13, 2023
1 parent 592a61c commit c8d7509
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
}

const CoCreateSocketClient = {
frameId: uuid.generate(8),
connected: false,
listeners: new Map(),
messageQueue: new Map(), // required per url already per url when isBrowser and indexeddb.
Expand Down Expand Up @@ -143,6 +144,7 @@
socket.id = options.socketId;
socket.connected = false;
socket.clientId = this.clientId;
socket.frameId = this.frameId;
socket.organization_id = data.organization_id || await this.organization_id();
socket.user_id = data.user_id || this.user_id;
socket.host = data.host || this.host;
Expand Down Expand Up @@ -304,7 +306,10 @@

send(data) {
return new Promise(async (resolve, reject) => {
if (!data)
data = {}
data.clientId = this.clientId;
data.frameId = this.frameId;

if (!data['timeStamp'])
data['timeStamp'] = new Date();
Expand Down

0 comments on commit c8d7509

Please sign in to comment.