Rantanen / node-dtls

JavaScript DTLS implementation for Node.js
ISC License
58 stars 15 forks source link

Handler not found for alert message #12

Closed nickdesaulniers closed 8 years ago

nickdesaulniers commented 8 years ago

it looks like "alert" is a type of message: https://github.com/Rantanen/node-dtls/blob/e7410c20d839fe95dfa76552f932bea05ad8f8b8/dtls.js#L8

for which there is no handler assigned: https://github.com/Rantanen/node-dtls/blob/e7410c20d839fe95dfa76552f932bea05ad8f8b8/DtlsSocket.js#L124-L134

are consumers of this lib expected to assign one?

Rantanen commented 8 years ago

It's one of the missing bits mentioned in the README.md. I don't remember how the specification defines the 'alert' messages - whether they are protocol level errors that should be handled within the socket or whether they should be handled in user code.

I guess a simple addition would be to emit them as 'error' events similar to how the applicationData is emitted as 'message' events. But this would then leave the responsibility of reacting to them to the user code.

Can you give an example of an alert you're receiving?

nickdesaulniers commented 8 years ago
{ type: 21,
  version: { major: -2, minor: -3 },
  epoch: 0,
  sequenceNumber: <Buffer 00 00 00 00 00 03>,
  fragment: <Buffer 02 28> }
nickdesaulniers commented 8 years ago

https://tools.ietf.org/html/rfc6347#section-4.1.2.7

nickdesaulniers commented 8 years ago

so it sounds like you're spec compliant from reading that section.