Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

socket.io-client@4.8.0

Compare
Choose a tag to compare
Loading
@darrachequesnedarrachequesne released this 21 Sep 08:06
· 22 commits to main since this release
4a0555c
This commit was signed with the committer’sverified signature. The key has expired.
darrachequesne Damien Arrachequesne
GPG key ID:544D14663E7F7CF0
Expired
Verified
Learn about vigilant mode.

Features

Custom transport implementations

Thetransports option now accepts an array of transport implementations:

import{io}from"socket.io-client";import{XHR,WebSocket}from"engine.io-client";constsocket=io({transports:[XHR,WebSocket]});

Here is the list of provided implementations:

TransportDescription
FetchHTTP long-polling based on the built-infetch() method.
NodeXHRHTTP long-polling based on theXMLHttpRequest object provided by thexmlhttprequest-ssl package.
XHRHTTP long-polling based on the built-inXMLHttpRequest object.
NodeWebSocketWebSocket transport based on theWebSocket object provided by thews package.
WebSocketWebSocket transport based on the built-inWebSocket object.
WebTransportWebTransport transport based on the built-inWebTransport object.

Usage:

TransportbrowserNode.jsDenoBun
Fetch✅ (1)
NodeXHR
XHR
NodeWebSocket
WebSocket✅ (2)
WebTransport

(1) sincev18.0.0
(2) sincev21.0.0

Added inf4d898e andb11763b.

Test each low-level transports

When setting thetryAllTransports option totrue, if the first transport (usually, HTTP long-polling) fails, then the other transports will be tested too:

import{io}from"socket.io-client";constsocket=io({tryAllTransports:true});

This feature is useful in two cases:

  • when HTTP long-polling is disabled on the server, or if CORS fails
  • when WebSocket is tested first (withtransports: ["websocket", "polling"])

The only potential downside is that the connection attempt could take more time in case of failure, as there have been reports of WebSocket connection errors taking several seconds before being detected (that's one reason for using HTTP long-polling first). That's why the option defaults tofalse for now.

Added in579b243.

Bug Fixes

  • accept string | undefined as init argument (bis) (60c757f)
  • allow to manually stop the reconnection loop (13c6d2e)
  • close the engine upon decoding exception (04c8dd9)
  • do not send a packet on an expired connection (#5134) (8adcfbf)

Dependencies

Assets2
Loading
ram-you, noelzappy, piyushchauhan2011, iguanasoft, KurtPachinger, xkiller838, cworsley4, Tona-Mangobyte, JeFawk, Neleka, and 7 more reacted with thumbs up emojikevgithub reacted with heart emoji
18 people reacted

[8]ページ先頭

©2009-2025 Movatter.jp