Skip to content

Commit

Permalink
update protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
gonpombo8 committed Jan 16, 2025
1 parent bb03f3a commit a27fb55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
"dependencies": {
"@actions/core": "^1.10.0",
"@dcl/protocol": "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-12754011500.commit-762ebe6.tgz",
"@dcl/protocol": "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-12791463180.commit-127443e.tgz",
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
"@dcl/ts-proto": "1.153.0",
"@types/fs-extra": "^9.0.12",
Expand Down
18 changes: 4 additions & 14 deletions packages/@dcl/sdk/src/network/message-bus-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,10 @@ export function addSyncTransport(
pendingMessageBusMessagesToSend.push({ data: [data], address: address ?? [] })
})

function getMessagesToSend(): [Uint8Array[], typeof pendingMessageBusMessagesToSend] {
function getMessagesToSend(): typeof pendingMessageBusMessagesToSend {
const messages = [...pendingMessageBusMessagesToSend]
pendingMessageBusMessagesToSend.length = 0
const broadcastMessages: Uint8Array[] = []
const peerMessages: typeof pendingMessageBusMessagesToSend = []

for (const message of messages) {
if (!message.address.length) {
broadcastMessages.push(...message.data)
} else {
peerMessages.push(message)
}
}
return [broadcastMessages, peerMessages]
return messages
}
const players = definePlayerHelper(engine)

Expand All @@ -61,9 +51,9 @@ export function addSyncTransport(
console.log(...Array.from(serializeCrdtMessages('[NetworkMessage sent]:', message, engine)))
binaryMessageBus.emit(CommsMessage.CRDT, message)
}
const [broadcastMessages, peerMessages] = getMessagesToSend()
const peerMessages = getMessagesToSend()

const response = await sendBinary({ data: broadcastMessages, peerData: peerMessages })
const response = await sendBinary({ data: [], peerData: peerMessages })
binaryMessageBus.__processMessages(response.data)
transportInitialzed = true
},
Expand Down

0 comments on commit a27fb55

Please sign in to comment.