Update the generateId utility function to use the new Node cryptogenerateUUID function. In addition, allow the user to override the default ID generation mechanism in the Session and Channel constructor options.
This has been benchmarked as having a significant performance improvement over using randomBytes: 129,016 opcs/sec -> 193,527 ops/sec.
Note that this will technically be a breaking change as it bumps the minimum Node version to v14.7.0 and also breaks the API contract that the event ID matches the Regex a-z0-9. However, seeing as Node 12 (the last maintained last version before Node 14) will reach end-of-life in three months, the user is able to override the event ID generation, and the unlikelihood that users are actually relying on the format of the default event ID string contents, I don't believe it will be much of an issue.
Update the
generateId
utility function to use the new Nodecrypto
generateUUID
function. In addition, allow the user to override the default ID generation mechanism in theSession
andChannel
constructor options.This has been benchmarked as having a significant performance improvement over using
randomBytes
:129,016 opcs/sec
->193,527 ops/sec
.Note that this will technically be a breaking change as it bumps the minimum Node version to
v14.7.0
and also breaks the API contract that the event ID matches the Regexa-z0-9
. However, seeing as Node 12 (the last maintained last version before Node 14) will reach end-of-life in three months, the user is able to override the event ID generation, and the unlikelihood that users are actually relying on the format of the default event ID string contents, I don't believe it will be much of an issue.