faye / faye-websocket-ruby

Standards-compliant WebSocket client and server
Other
1.04k stars 96 forks source link

Opening a connection with a query string #134

Open zcoverstone opened 2 years ago

zcoverstone commented 2 years ago

I've previously been using Axios for a project, but I am looking to port it over to faye-websocket-ruby. The code I am looking to port doesn't seem to have an apparent equivalent that I can find for this project:

Here is an example

mysocket = io(CONNECT_STR, { path: "/xyz", transport: ['websocket'], query: {itemOne: 1, itemTwo: 2} });

Specifically, I am struggling with the path and query options; is there an equivalent to faye-websocket-ruby?

jcoglan commented 2 years ago

This library does not have distinct options for constructing the connection URL, it expects to be given a complete URL and only parses it to the extent necessary to make the initial HTTP request. To make a client connection:

ws = Faye::WebSocket::Client.new('ws://example.com/xyz?itemOne=1&itemTwo=2')