-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
WIP: Add support for http protocol requests #198
Conversation
90eb7db
to
c27a016
Compare
7629ab0
to
9cf2be1
Compare
Debased and simplified, ready for landing @nechaido |
lib/client.js
Outdated
@@ -92,7 +92,7 @@ class Metacom extends EventEmitter { | |||
const target = interfaceName + '/' + methodName; | |||
const packet = { call: callId, [target]: args }; | |||
const dest = new URL(this.url); | |||
const protocol = dest.protocol === 'ws:' ? 'http' : 'https'; | |||
const protocol = dest.protocol.endsWith('s') ? 'https' : 'http'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tshemsedinov both ws
and wss
end with s
that's why I used the check I used.
7743daf
to
9cf2be1
Compare
See client-side implementation: https://github.com/metarhia/metacom/tree/master/dist |
I'd prefer to have the same version for both node and browser clients. |
Looks like not actual as of 2024-02-12 |
Currently, request to
http://localhost/api
would be transformed into requests tohttps://localhost/api
, this will result in an obvious but hard-to-track OpenSSL error.