Skip to content

Commit e1fbf2d

Browse files
author
nullagent
committed
fix issue 118 and remove unnecessary stringify
1 parent c2f6b5b commit e1fbf2d

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/comms/peer-comms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ class PeerComms extends ISocketComms {
231231
this.close()
232232
}
233233

234-
async close(){
235-
debug('close', this.uuid)
234+
async close(event){
235+
debug('close', this.uuid, event)
236236

237237
if(this.party.topics){
238238
await this.party.topics.destroyNode(this)

src/comms/websocket-shim.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ class WebsocketShim extends EventEmitter {
1818
setTimeout(()=>{this.emit('connect')}, 1)
1919
}
2020

21-
this.conn.onclose = () => {
22-
this.emit('close')
21+
this.conn.onclose = (event) => {
22+
debug('onclose', event)
23+
this.emit('close', event)
2324
}
2425

2526
this.conn.onerror = (err) => {

src/topics/peer-node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class PeerNode {
2929
msg: data
3030
})*/
3131

32-
await this.peer.send(JSON.stringify({
32+
await this.peer.send({
3333
op: 'publish',
3434
id: 'publish:'+this.peer.opId,
3535
topic: topic.path,
36-
sender: { uuid: this.peer.uuid, identity: this.peer.remoteIdentity },
36+
sender: sender ? { uuid: this.sender.uuid, identity: this.sender.peer.remoteIdentity } : {system: true},
3737
msg: data
38-
}))
38+
})
3939

4040
}
4141
}

0 commit comments

Comments
 (0)