mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
socket.io: Factor out client connection logic
This commit is contained in:
parent
7eb0f996c3
commit
303964c51e
8 changed files with 44 additions and 38 deletions
|
@ -1,16 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
$(document).ready(() => {
|
||||
const loc = document.location;
|
||||
const port = loc.port === '' ? (loc.protocol === 'https:' ? 443 : 80) : loc.port;
|
||||
const url = `${loc.protocol}//${loc.hostname}:${port}/`;
|
||||
const pathComponents = location.pathname.split('/');
|
||||
// Strip admin/plugins
|
||||
const baseURL = `${pathComponents.slice(0, pathComponents.length - 2).join('/')}/`;
|
||||
/* global socketio */
|
||||
|
||||
// connect
|
||||
const room = `${url}pluginfw/installer`;
|
||||
const socket = io.connect(room, {path: `${baseURL}socket.io`});
|
||||
$(document).ready(() => {
|
||||
const socket = socketio.connect('..', '/pluginfw/installer');
|
||||
|
||||
const search = (searchTerm, limit) => {
|
||||
if (search.searchTerm !== searchTerm) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue