-
Notifications
You must be signed in to change notification settings - Fork 12
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
Does this project also support the socket.io client? #12
Labels
enhancement
New feature or request
Comments
Hi! No, the JavaScript client is not compatible with Deno, but if there is enough interest we could totally implement it. |
So, how connect from client with server? |
I'm worried about that too... |
people, it can be done with deno using the socket.io client This code works:
|
darrachequesne
added a commit
to socketio/engine.io-client
that referenced
this issue
May 31, 2024
This commit adds the ability to provide a list of transport implementations to use when connecting to an Engine.IO server. This can be used to use HTTP long-polling based on `fetch()`, instead of the default implementation based on the `XMLHttpRequest` object. ``` import { Socket, Fetch, WebSocket } from "engine.io-client"; const socket = new Socket({ transports: [Fetch, WebSocket] }); ``` This is useful in some environments that do not provide a `XMLHttpRequest` object, like Chrome extension background scripts. > XMLHttpRequest() can't be called from a service worker, extension or otherwise. Replace calls from your background script to XMLHttpRequest() with calls to global fetch(). Source: https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers#replace-xmlhttprequest Related: - #716 - socketio/socket.io#4980 This is also useful when running the client with Deno or Bun, as it allows to use the built-in `fetch()` method and `WebSocket` object, instead of using the `xmlhttprequest-ssl` and `ws` Node.js packages. Related: socketio/socket.io-deno#12 This feature also comes with the ability to exclude the code related to unused transports (a.k.a. "tree-shaking"): ```js import { SocketWithoutUpgrade, WebSocket } from "engine.io-client"; const socket = new SocketWithoutUpgrade({ transports: [WebSocket] }); ``` In that case, the code related to HTTP long-polling and WebTransport will be excluded from the final bundle. Related: socketio/socket.io#4393
@RomanFama592 does it work from a web browser? |
This is what is holding me back from using Deno. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recently, I was trying to use
import { io } from "https://cdn.socket.io/4.6.1/socket.io.esm.min.js";
in a deno project, but it didn't seem to work. Nothing was emitted. 🤔 Maybe this project implements a fixed version of the socket.io client? I couldn't find it in the repo, but I hope it's somewhere in here. Thanks much!The text was updated successfully, but these errors were encountered: