From 5a6f9b0c16a76c92ae4a980fc735eac15de0211e Mon Sep 17 00:00:00 2001 From: DagnirCuthalion <65599186+DagnirCuthalion@users.noreply.github.com> Date: Mon, 20 Jun 2022 15:24:51 +0200 Subject: [PATCH] changed stated io(url) default values Based on https://github.com/socketio/socket.io-client/blob/main/dist/socket.io.js#L3964 the default is neither `window.location` nor `/` but instead `/socket.io` --- docs/client-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/client-api.md b/docs/client-api.md index 35f30666..8939b801 100644 --- a/docs/client-api.md +++ b/docs/client-api.md @@ -69,14 +69,14 @@ You can find more information [here](https://github.com/socketio/socket.io-proto ### io([url][, options]) - - `url` [``](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type) (defaults to `window.location`) + - `url` [``](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type) (defaults to `/socket.io`) - `options` [``](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) - `forceNew` [``](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type) whether to create a new connection - **Returns** [``](#socket) Creates a new `Manager` for the given URL, and attempts to reuse an existing `Manager` for subsequent calls, unless the `multiplex` option is passed with `false`. Passing this option is the equivalent of passing `"force new connection": true` or `forceNew: true`. -A new `Socket` instance is returned for the namespace specified by the pathname in the URL, defaulting to `/`. For example, if the `url` is `http://localhost/users`, a transport connection will be established to `http://localhost` and a Socket.IO connection will be established to `/users`. +A new `Socket` instance is returned for the namespace specified by the pathname in the URL, defaulting to `/socket.io`. For example, if the `url` is `http://localhost/users`, a transport connection will be established to `http://localhost` and a Socket.IO connection will be established to `/users`. Query parameters can also be provided, either with the `query` option or directly in the url (example: `http://localhost/users?token=abc`).