mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
add ok and err events
This commit is contained in:
parent
b4a65d0309
commit
d5c9f4d88c
1 changed files with 17 additions and 1 deletions
|
|
@ -155,7 +155,11 @@ class Connection extends EventEmitter {
|
|||
const bufferReader = new BufferReader(frame);
|
||||
const responseCode = bufferReader.readByte();
|
||||
|
||||
if(responseCode === Constants.ResponseCodes.SelfInfo){
|
||||
if(responseCode === Constants.ResponseCodes.Ok){
|
||||
this.onOkResponse(bufferReader);
|
||||
} else if(responseCode === Constants.ResponseCodes.Err){
|
||||
this.onErrResponse(bufferReader);
|
||||
} else if(responseCode === Constants.ResponseCodes.SelfInfo){
|
||||
this.onSelfInfoResponse(bufferReader);
|
||||
} else if(responseCode === Constants.ResponseCodes.CurrTime){
|
||||
this.onCurrTimeResponse(bufferReader);
|
||||
|
|
@ -212,6 +216,18 @@ class Connection extends EventEmitter {
|
|||
});
|
||||
}
|
||||
|
||||
onOkResponse(bufferReader) {
|
||||
this.emit(Constants.ResponseCodes.Ok, {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
onErrResponse(bufferReader) {
|
||||
this.emit(Constants.ResponseCodes.Err, {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
onContactsStartResponse(bufferReader) {
|
||||
this.emit(Constants.ResponseCodes.ContactsStart, {
|
||||
count: bufferReader.readUInt32LE(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue