sidorares / vnc-over-gif

513 stars 28 forks source link

Suggested Changes (sessions, queuing, json bodies) #7

Closed mlilley closed 11 years ago

mlilley commented 11 years ago

Had a moment free to implement the suggested changes:

I was of two minds about whether to send the session cookie in response to the request for the html file, or the gif file. Not sure it matters much either way, but if you'd prefer to have it sent with the GIF, let me know.

Re the final suggestion (queuing and sending of server -> client messages in update responses) -- sounds good. We'll need to chat about how these messages get produced from the connection.

sidorares commented 11 years ago

Looks good!

RE server->client updates: something like this


   function enqueueUpdate(client, update) {
     update.timestamp = Date.now(); 
     client.updates.push(update);
   }

   r.updates = []; // or maybe new Queue(), see https://github.com/creationix/fastqueue
   r.on('clipboard', function(newPasteBufData) {
      enqueueUpdate({ type: 'clipboard', value: newPasteBufData});
   });
   r.on('bell', function() {
      enqueueUpdate({ type: 'bell'});
   });
   r.on('resize', function(rect) {
      enqueueUpdate({ type: 'display-resize', value: rect});
   });