Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor peer protocol handling #7

Closed
Tracked by #47
sevenbitbyte opened this issue May 22, 2020 · 2 comments
Closed
Tracked by #47

Refactor peer protocol handling #7

sevenbitbyte opened this issue May 22, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sevenbitbyte
Copy link
Member

sevenbitbyte commented May 22, 2020

Should refactor RTCPeerComms.handleClientCall into some sort of host protocol handler.

  • Authenticate actor
  • Mode select
    • rest
      • peer-party
      • custom peer endpoints []
    • peer-socket
      • Document change - /dataparty/document/${type}/${id}

async handleClientCall(message){
let response = null
const request = await this.decrypt( {data: message}, this.remoteIdentity )
debug('handleHostCall', request)
if(!this.authed){
if(request.op == 'auth'){
debug('allowing client')
response = {
op: 'status',
id: request.id,
level: 'Info',
state: 'Finished_Success'
}
clearTimeout(this._host_auth_timeout)
this._host_auth_timeout = null
this.authed = true
this.emit('open')
this.send(response)
}
return
}
if (request.op == 'peer-call') {
debug('peer-call')
if(request.endpoint == 'api-v2-peer-bouncer'){
debug('ask->',request.data)
this.send({
op: 'status',
id: request.id,
state: 'Finished_Success',
...await this.party.handleCall(request.data)
})
}
}
}

@sevenbitbyte sevenbitbyte added the enhancement New feature or request label May 22, 2020
@sevenbitbyte sevenbitbyte self-assigned this May 22, 2020
@sevenbitbyte
Copy link
Member Author

See #39 "improve the peer comms protocol and expected behavior of hosts."

@sevenbitbyte
Copy link
Member Author

sevenbitbyte commented Feb 28, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant