Skip to content

Update to ws >= 8 #385

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

Closed
guimard opened this issue Mar 29, 2022 · 2 comments
Closed

Update to ws >= 8 #385

guimard opened this issue Mar 29, 2022 · 2 comments
Labels

Comments

@guimard
Copy link

guimard commented Mar 29, 2022

Hi,

for the record, here is a fix to update to ws >= 8 (should probably be improved):

--- a/lib/testutil.js
+++ b/lib/testutil.js
@@ -3,7 +3,7 @@
 var http = require("http");
 var URL = require("url");
 var extend = require("util")._extend;
-var WebSocketServer = require("ws").Server;
+var WebSocketServer = require("ws").WebSocketServer;
 var querystring = require("querystring");

 var configproxy = require("./configproxy");
--- a/test/proxy_spec.js
+++ b/test/proxy_spec.js
@@ -62,13 +62,16 @@
     var nmsgs = 0;
     ws.on("message", function (msg) {
       if (nmsgs === 0) {
-        expect(msg).toEqual("connected");
+        expect(msg.toString()).toEqual("connected");
       } else {
         msg = JSON.parse(msg);
         expect(msg).toEqual(
           jasmine.objectContaining({
             path: "/",
-            message: "hi",
+            message: {
+              type: 'Buffer',
+              data: [ 104, 105 ]
+            }
           })
         );
         // check last_activity was updated

Cheers,
Yadd

@guimard guimard added the bug label Mar 29, 2022
@consideRatio
Copy link
Member

@guimard thank you this is great! Thank you!

@consideRatio
Copy link
Member

From #361 this seems already resolved, but I wonder if maybe it should be a WebSocketServer instead of Server as in your diff suggestion.

Closing this issue, but following up the comment above in #403.

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

No branches or pull requests

2 participants