Skip to content

Commit

Permalink
Merge pull request #9 from overleaf/bg-remove-client
Browse files Browse the repository at this point in the history
remove dependency on socket.io-client
  • Loading branch information
briangough authored Oct 25, 2022
2 parents 6bf168f + 7ec1233 commit 0f1d0b6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 404 deletions.
10 changes: 10 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
0.9.19-overleaf-8 / 2022-08-18
==============================

* Overleaf: removes dependency on socket.io-client, requests for socket.io.js must be served from the top-level app

0.9.19-overleaf-7 / 2022-08-18
==============================

* Overleaf: updates this package to use the latest version of our fork of the socket.io-client library (0.9.17-overleaf-4)

0.9.19-overleaf-6 / 2022-08-18
==============================

Expand Down
10 changes: 7 additions & 3 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ var fs = require('fs')
, crypto = require('crypto')
, util = require('./util')
, store = require('./store')
, client = require('socket.io-client')
, transports = require('./transports')
, Logger = require('./logger')
, Socket = require('./socket')
, MemoryStore = require('./stores/memory')
, SocketNamespace = require('./namespace')
, Static = require('./static')
, Static = null
, EventEmitter = require('events').EventEmitter;

/**
Expand Down Expand Up @@ -65,7 +64,7 @@ function Manager (server, options) {
, log: true
, store: new MemoryStore
, logger: new Logger
, static: new Static(this)
, static: new Set(['/socket.io.js']) // Overleaf: set of paths for static serving by app
, heartbeats: true
, resource: '/socket.io'
, transports: defaultTransports
Expand Down Expand Up @@ -991,6 +990,11 @@ Manager.prototype.checkRequest = function (req) {
, path: path
};

// Overleaf: pass all static pages back to top-level app
if (this.static.has(path)) {
return false
}

if (pieces) {
data.protocol = Number(pieces[1]);
data.transport = pieces[2];
Expand Down
8 changes: 5 additions & 3 deletions lib/socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
* Module dependencies.
*/

var client = require('socket.io-client');
// Removed from Overleaf version
// var client = require('socket.io-client');

/**
* Version.
Expand All @@ -27,7 +28,8 @@ exports.protocol = 1;
* Client that we serve.
*/

exports.clientVersion = client.version;
// Removed from Overleaf version
// exports.clientVersion = client.version;

/**
* Attaches a manager
Expand Down Expand Up @@ -108,7 +110,7 @@ exports.Socket = require('./socket');
* @api public
*/

exports.Static = require('./static');
exports.Static = null;

/**
* Store constructor.
Expand Down
Loading

0 comments on commit 0f1d0b6

Please sign in to comment.