mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Remove Pusher-related code
This commit is contained in:
@@ -5,7 +5,6 @@ telepath = require 'telepath'
|
||||
Project = require 'project'
|
||||
MediaConnection = require './media-connection'
|
||||
sessionUtils = require './session-utils'
|
||||
Pusher = require '../vendor/pusher'
|
||||
Session = require './session'
|
||||
|
||||
module.exports =
|
||||
|
||||
@@ -7,7 +7,6 @@ telepath = require 'telepath'
|
||||
|
||||
MediaConnection = require './media-connection'
|
||||
sessionUtils = require './session-utils'
|
||||
Pusher = require '../vendor/pusher'
|
||||
Session = require './session'
|
||||
|
||||
module.exports =
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
_ = require 'underscore'
|
||||
|
||||
module.exports =
|
||||
class RateLimitedChannel
|
||||
_.extend @prototype, require('event-emitter')
|
||||
|
||||
constructor: (@channel) ->
|
||||
@queue = []
|
||||
|
||||
setInterval(@sendBatch, 200)
|
||||
@channel.bind_all (eventName, args...) =>
|
||||
if eventName is 'client-batch'
|
||||
@receiveBatch(args...)
|
||||
else
|
||||
@trigger eventName, args...
|
||||
|
||||
receiveBatch: (batch) =>
|
||||
@trigger event... for event in batch
|
||||
|
||||
sendBatch: =>
|
||||
return if @queue.length is 0
|
||||
|
||||
batch = []
|
||||
batchSize = 2
|
||||
while event = @queue.shift()
|
||||
eventJson = JSON.stringify(event)
|
||||
if batchSize + eventJson.length > 10000
|
||||
console.log 'over 10k in batch, bailing'
|
||||
@queue.unshift(event)
|
||||
break
|
||||
else
|
||||
batch.push(eventJson)
|
||||
batchSize += eventJson.length + 1
|
||||
|
||||
console.log 'sending batch'
|
||||
@channel.trigger 'client-batch', "[#{batch.join(',')}]"
|
||||
|
||||
send: (args...) ->
|
||||
@queue.push(args)
|
||||
@@ -11,14 +11,6 @@ class Session
|
||||
console.log "subscribing", channelName
|
||||
new WsChannel(channelName)
|
||||
|
||||
getPusherConnection: ->
|
||||
@pusher ?= new Pusher '490be67c75616316d386',
|
||||
encrypted: true
|
||||
authEndpoint: 'https://fierce-caverns-8387.herokuapp.com/pusher/auth'
|
||||
auth:
|
||||
params:
|
||||
oauth_token: keytar.getPassword('github.com', 'github')
|
||||
|
||||
connectDocument: (doc, channel) ->
|
||||
nextOutputEventId = 1
|
||||
outputListener = (event) ->
|
||||
|
||||
@@ -5,14 +5,23 @@ keytar = require 'keytar'
|
||||
GuestSession = require '../lib/guest-session'
|
||||
HostSession = require '../lib/host-session'
|
||||
|
||||
class PusherServer
|
||||
class Server
|
||||
constructor: ->
|
||||
@channels = {}
|
||||
|
||||
getChannel: (channelName) ->
|
||||
@channels[channelName] ?= new ChannelServer(channelName)
|
||||
|
||||
createClient: -> new PusherClient(this)
|
||||
createClient: -> new Client(this)
|
||||
|
||||
class Client
|
||||
@nextId: 1
|
||||
|
||||
constructor: (@server) ->
|
||||
@id = @constructor.nextId++
|
||||
|
||||
subscribe: (channelName) ->
|
||||
@server.getChannel(channelName).subscribe(this)
|
||||
|
||||
class ChannelServer
|
||||
constructor: (@name) ->
|
||||
@@ -36,15 +45,6 @@ class ChannelServer
|
||||
for client in @getChannelClients() when client isnt sendingClient
|
||||
client.trigger(eventName, eventData)
|
||||
|
||||
class PusherClient
|
||||
@nextId: 1
|
||||
|
||||
constructor: (@server) ->
|
||||
@id = @constructor.nextId++
|
||||
|
||||
subscribe: (channelName) ->
|
||||
@server.getChannel(channelName).subscribe(this)
|
||||
|
||||
class ChannelClient
|
||||
_.extend @prototype, require('event-emitter')
|
||||
|
||||
@@ -53,14 +53,14 @@ class ChannelClient
|
||||
send: (eventName, eventData) ->
|
||||
@channelServer.send(this, eventName, eventData)
|
||||
|
||||
describe "Collaboration", ->
|
||||
fdescribe "Collaboration", ->
|
||||
describe "joining a host session", ->
|
||||
[hostSession, guestSession, pusher, repositoryMirrored] = []
|
||||
|
||||
beforeEach ->
|
||||
spyOn(keytar, 'getPassword')
|
||||
jasmine.unspy(window, 'setTimeout')
|
||||
pusherServer = new PusherServer()
|
||||
pusherServer = new Server()
|
||||
hostSession = new HostSession(new Site(1))
|
||||
spyOn(hostSession, 'snapshotRepository').andCallFake (callback) ->
|
||||
callback({url: 'git://server/repo.git'})
|
||||
|
||||
3614
src/packages/collaboration/vendor/pusher.js
vendored
3614
src/packages/collaboration/vendor/pusher.js
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user