mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-08 08:01:02 -04:00
Use socket io v4
This commit is contained in:
parent
eab18fae4b
commit
b6eaba64d4
6 changed files with 9 additions and 9 deletions
|
@ -527,7 +527,7 @@
|
|||
/*
|
||||
* Restrict socket.io transport methods
|
||||
*/
|
||||
"socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
|
||||
"socketTransportProtocols" : ["polling", "websocket"],
|
||||
|
||||
"socketIo": {
|
||||
/*
|
||||
|
|
|
@ -527,7 +527,7 @@
|
|||
/*
|
||||
* Restrict socket.io transport methods
|
||||
*/
|
||||
"socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
|
||||
"socketTransportProtocols" : ["polling", "websocket"],
|
||||
|
||||
"socketIo": {
|
||||
/*
|
||||
|
|
|
@ -51,8 +51,8 @@ exports.expressCreateServer = (hookName, args, cb) => {
|
|||
// there shouldn't be a browser that isn't compatible to all
|
||||
// transports in this list at once
|
||||
// e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling
|
||||
io = socketio({
|
||||
transports: settings.socketTransportProtocols,
|
||||
io = new socketio.Server({
|
||||
transports: settings.socketTransportProtocols
|
||||
}).listen(args.server, {
|
||||
/*
|
||||
* Do not set the "io" cookie.
|
||||
|
@ -106,14 +106,14 @@ exports.expressCreateServer = (hookName, args, cb) => {
|
|||
});
|
||||
|
||||
io.use((socket, next) => {
|
||||
socket.conn.on('packet', (packet) => {
|
||||
socket.conn.on('package', (packet) => {
|
||||
// Tell express-session that the session is still active. The session store can use these
|
||||
// touch events to defer automatic session cleanup, and if express-session is configured with
|
||||
// rolling=true the cookie's expiration time will be renewed. (Note that WebSockets does not
|
||||
// have a standard mechanism for periodically updating the browser's cookies, so the browser
|
||||
// will not see the new cookie expiration time unless it makes a new HTTP request or the new
|
||||
// cookie value is sent to the client in a custom socket.io message.)
|
||||
if (socket.request.session != null) socket.request.session.touch();
|
||||
if (packet.request.session != null) packet.request.session.touch();
|
||||
});
|
||||
next();
|
||||
});
|
||||
|
|
|
@ -126,7 +126,7 @@ exports.ssl = false;
|
|||
/**
|
||||
* socket.io transport methods
|
||||
**/
|
||||
exports.socketTransportProtocols = ['xhr-polling', 'jsonp-polling', 'htmlfile'];
|
||||
exports.socketTransportProtocols = ["polling", "websocket"];
|
||||
|
||||
exports.socketIo = {
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@ const connect = (etherpadBaseUrl, namespace = '/', options = {}) => {
|
|||
const baseUrl = new URL(etherpadBaseUrl, window.location);
|
||||
const socketioUrl = new URL('socket.io', baseUrl);
|
||||
const namespaceUrl = new URL(namespace, new URL('/', baseUrl));
|
||||
return io(namespaceUrl.href, Object.assign({path: socketioUrl.pathname}, options));
|
||||
return new io.Socket(namespaceUrl.href, Object.assign({path: socketioUrl.pathname}, options));
|
||||
};
|
||||
|
||||
if (typeof exports === 'object') {
|
||||
|
|
|
@ -145,7 +145,7 @@ exports.connect = async (res = null) => {
|
|||
if (res) {
|
||||
padId = res.req.path.split('/p/')[1];
|
||||
}
|
||||
const socket = io(`${exports.baseUrl}/`, {
|
||||
const socket = new io.Socket(`${exports.baseUrl}/`, {
|
||||
forceNew: true, // Different tests will have different query parameters.
|
||||
path: '/socket.io',
|
||||
// socketio.js-client on node.js doesn't support cookies (see https://git.io/JU8u9), so the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue