PageSourceSearch

https://socket.io/assets/js/e3a140b5.e79cd4fc.js

js socket.io collected 2026-09-24 07:23:52 UTC 11,102 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunksample_website=self.webpackChunksample_website||[]).push([[897],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>k});var n=a(7294);function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){o(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,o=function(e,t){if(null==e)return{};var a,n,o={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(o[a]=e[a]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(o[a]=e[a])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),m=p(a),d=o,k=m["".concat(s,".").concat(d)]||m[d]||u[d]||r;return a?n.createElement(k,i(i({ref:t},c),{},{components:a})):n.createElement(k,i({ref:t},c))}));function k(e,t){var a=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=a.length,i=new Array(r);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:o,i[1]=l;for(var p=2;p<r;p++)i[p]=a[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"},657:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var n=a(3117),o=(a(7294),a(3905));const r={title:"Monthly update #3",slug:"/monthly-update-3/",authors:"darrachequesne"},i=void 0,l={permalink:"/blog/monthly-update-3/",editUrl:"https://github.com/socketio/socket.io-website/edit/main/blog/2021-04-07-monthly-update-3.md",source:"@site/blog/2021-04-07-monthly-update-3.md",title:"Monthly update #3",description:"Hi everyone!",date:"2021-04-07T00:00:00.000Z",formattedDate:"April 7, 2021",tags:[],readingTime:2.28,hasTruncateMarker:!0,authors:[{name:"Damien Arrachequesne",title:"Maintainer of Socket.IO",url:"https://github.com/darrachequesne",imageURL:"https://github.com/darrachequesne.png",key:"darrachequesne"}],frontMatter:{title:"Monthly update #3",slug:"/monthly-update-3/",authors:"darrachequesne"},prevItem:{title:"Socket.IO Admin UI",permalink:"/blog/admin-ui-first-release/"},nextItem:{title:"Socket.IO 4.0.0",permalink:"/blog/socket-io-4-release/"}},s={authorsImageUrls:[void 0]},p=[{value:"Socket.IO v4",id:"socketio-v4",level:2},{value:"Redis Adapter v6.1.0 and Redis Emitter v4.0.0",id:"redis-adapter-v610-and-redis-emitter-v400",level:2},{value:"Documentation",id:"documentation",level:2},{value:"New versions",id:"new-versions",level:2},{value:"What&#39;s next",id:"whats-next",level:2}],c={toc:p},m="wrapper";
1function u(e){let{components:t,...a}=e;return(0,o.kt)(m,(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Hi everyone!"),(0,o.kt)("p",null,"Here's the #3 edition of our Monthly update."),(0,o.kt)("p",null,"So, what's new in the Socket.IO ecosystem?"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#socketio-v4"},"Socket.IO v4")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#redis-adapter-v610-and-redis-emitter-v400"},"Redis Adapter v6.1.0 and Redis Emitter v4.0.0")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#documentation"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#new-versions"},"New versions")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#whats-next"},"What's next"))),(0,o.kt)("h2",{id:"socketio-v4"},"Socket.IO v4"),(0,o.kt)("p",null,"Wait, already v4?"),(0,o.kt)("p",null,"Yes, but the upgrade should be a lot easier than from v2 to v3, since the two breaking changes only impact the API on the server side."),(0,o.kt)("p",null,"The most important breaking change is related to broadcasting: calling ",(0,o.kt)("inlineCode",{parentName:"p"},"to()")," or any other broadcast modifier will now return an immutable object."),(0,o.kt)("p",null,"Previously, the modifiers were saved on the ",(0,o.kt)("inlineCode",{parentName:"p"},"io")," instance directly, which could lead to surprising behaviors:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},'io.to("room1");\n// and then later\nio.to("room2").emit(/* ... */); // also sent to room1\n')),(0,o.kt)("p",null,"You were also not able to reuse the operator:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},'const operator = io.to("room1");\n\noperator.emit(/* ... */); // to room1 (assuming synchronous call)\noperator.emit(/* ... */); // to all clients\n')),(0,o.kt)("p",null,"Even more surprising, with asynchronous code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},'io.to("room3").emit("details", await fetchDetails()); // unspecified behavior: maybe in room3, maybe to all clients\n')),(0,o.kt)("p",null,"Starting with v4.0.0, you can now use ",(0,o.kt)("inlineCode",{parentName:"p"},"io.to()")," safely:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},'const operator = io.to("room1").except("room2");\n\noperator.emit(/* ... */);\noperator.emit(/* ... */);\n')),(0,o.kt)("p",null,"This release also brings some interesting new features, like the ",(0,o.kt)("inlineCode",{parentName:"p"},"fetchSockets()")," method."),(0,o.kt)("p",null,"Please check the migration guide ",(0,o.kt)("a",{parentName:"p",href:"/docs/v4/migrating-from-3-x-to-4-0/"},"here"),"."),(0,o.kt)("h2",{id:"redis-adapter-v610-and-redis-emitter-v400"},"Redis Adapter v6.1.0 and Redis Emitter v4.0.0"),(0,o.kt)("p",null,"The Redis adapter (for broadcasting packets with multiple Socket.IO servers) and the Redis emitter (for broadcasting packets from another Node.js process) have been updated in order to support the ",(0,o.kt)("a",{parentName:"p",href:"/docs/v4/migrating-from-3-x-to-4-0/#new-features"},"new features")," of the v4 release."),(0,o.kt)("p",null,"For example, the ",(0,o.kt)("inlineCode",{parentName:"p"},"socketsJoin")," method will work across Socket.IO servers:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},'// make all Socket instances join the "room1" room\nio.socketsJoin("room1");\n\n// make all Socket instances in the "room1" room join the "room2" and "room3" rooms\nio.in("room1").socketsJoin(["room2", "room3"]);\n\n// make all Socket instances in the "room1" room of the "admin" namespace join the "room2" room\nio.of("/admin").in("room1").socketsJoin("room2");\n')),(0,o.kt)("p",null,"More information can be found ",(0,o.kt)("a",{parentName:"p",href:"/docs/v4/server-instance/#utility-methods"},"here"),"."),(0,o.kt)("h2",{id:"documentation"},"Documentation"),(0,o.kt)("p",null,"The documentation continues to be improved."),(0,o.kt)("p",null,'A new example project has been added in the "Get started" section, with middlewares and rooms: ',(0,o.kt)("a",{parentName:"p",href:"/get-started/private-messaging-part-1/"},"Private messaging")),(0,o.kt)("p",null,"As usual, if you find a typo or think that some details are missing, please open an issue here: ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/socketio/socket.io-website"},"https://github.com/socketio/socket.io-website")),(0,o.kt)("h2",{id:"new-versions"},"New versions"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://github.com/socketio/socket.io/releases/tag/4.0.1"},"[email protected]")," (",(0,o.kt)("a",{parentName:"p",href:"/blog/socket-io-3-release/"},"release notes"),")"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/socketio/engine.io-parser/releases/tag/4.0.2"},"[email protected]")," (included in ",(0,o.kt)("inlineCode",{parentName:"li"},"socket.io{% raw %}@{% endraw %}4.0.1"),")"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/socketio/engine.io/releases/tag/5.0.0"},"[email protected]")," (included in ",(0,o.kt)("inlineCode",{parentName:"li"},"socket.io{% raw %}@{% endraw %}4.0.1"),")"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/socketio/socket.io-parser/releases/tag/4.0.4"},"[email protected]")," (included in ",(0,o.kt)("inlineCode",{parentName:"li"},"socket.io{% raw %}@{% endraw %}4.0.1"),")"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://github.com/socketio/socket.io-client/releases/tag/4.0.1"},"[email protected]")),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/socketio/engine.io-parser/releases/tag/4.0.2"},"[email protected]")," (included in ",(0,o.kt)("inlineCode",{parentName:"li"},"socket.io-client{% raw %}@{% endraw %}4.0.1"),")"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/socketio/engine.io-client/releases/tag/5.0.1"},"[email protected]")," (included in ",(0,o.kt)("inlineCode",{parentName:"li"},"socket.io-client{% raw %}@{% endraw %}4.0.1"),")"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/socketio/socket.io-parser/releases/tag/4.0.4"},"[email protected]")," (included in ",(0,o.kt)("inlineCode",{parentName:"li"},"socket.io-client{% raw %}@{% endraw %}4.0.1"),")"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://github.com/socketio/socket.io-redis/releases/tag/6.1.0"},"[email protected]"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://github.com/socketio/socket.io-redis-emitter/releases/tag/4.0.0"},"@socket.io/[email protected]")))),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"a continuous focus on the documentation (additional code examples, extended guide, ...)"),(0,o.kt)("li",{parentName:"ul"},"additional tooling around Socket.IO")),(0,o.kt)("p",null,"Stay safe!"))}u.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.