Merge pull request #2872 from umakantv/patch-1

[Fix] Convert message from Buffer to String
This commit is contained in:
Ilya Kantor 2022-02-17 08:36:36 +03:00 committed by GitHub
commit 6eba0627a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@ function accept(req, res) {
function onConnect(ws) {
ws.on('message', function (message) {
message = message.toString();
let name = message.match(/([\p{Alpha}\p{M}\p{Nd}\p{Pc}\p{Join_C}]+)$/gu) || "Guest";
ws.send(`Hello from server, ${name}!`);