Permalink
Browse files

Use LZMA compression for PPU:Initialize message.

Websocket connection is being dropped when deployed on Nodejitsu,
presumably due to the large size of the PPU:Initialize packet.
  • Loading branch information...
ecin committed May 27, 2012
1 parent 1d1adf6 commit 6a772f83204f415a34f251ff6890abdbdfccaa4a
Showing with 3,851 additions and 11 deletions.
  1. +13 −6 package.json
  2. +2 −0 public/js/joynes/base.js
  3. +4 −2 public/js/joynes/master.js
  4. +1 −0 public/js/joynes/slave.js
  5. +3,826 −0 public/js/lzma_worker.js
  6. +4 −3 views/index.ejs
  7. +1 −0 views/layout.ejs
View
@@ -1,11 +1,18 @@
{
- "name":"joynes",
- "version":"0.0.1a",
- "main":"main",
- "dependencies":
- {
+ "name": "joynes",
+ "version": "0.0.1a",
+ "main": "main",
+ "dependencies": {
"express": "~2.5",
"ejs": "~0.6",
- "socket.io": "~0.8"
+ "socket.io": "~0.8",
+ "lzma": "~1.2"
+ },
+ "subdomain": "joynes",
+ "scripts": {
+ "start": "server.js"
+ },
+ "engines": {
+ "node": "0.6.x"
}
}
View
@@ -20,6 +20,8 @@ joynes.Base.prototype = {
readStatusRegister: 17,
},
+ compressor : LZMA,
+
partner : function(command, data) {
var self = this;
self.socket.emit("proxy", {"command": command, "data": data })
@@ -98,7 +98,7 @@ joynes.Master.prototype = {
this.nes.ppu.ptTile[1].initialized = true;
console.log(this.nes.ppu.ptTile[1]);
var self = this;
- self.partner("PPU:Initialize", {
+ var payload = {
"instruction": self.instruction_id,
"vramMem": this.nes.ppu.vramMem,
"spriteMem": this.nes.ppu.spriteMem,
@@ -171,7 +171,9 @@ joynes.Master.prototype = {
"palTable": this.nes.ppu.palTable,
"controlReg1Value": this.nes.ppu.controlReg1Value,
"controlReg2Value": this.nes.ppu.controlReg2Value,
- });
+ }
+
+ self.partner("PPU:Initialize", self.compressor.compress(JSON.stringify(payload)));
self.partner("MMAP:Initialize", {
"mapperType": self.nes.rom.mapperType,
@@ -22,6 +22,7 @@ joynes.Slave.prototype = {
});
self.socket.on("PPU:Initialize", function(data) {
+ data = JSON.parse(self.compressor.decompress(data));
self.nes.ppu.vramMem = data["vramMem"];
self.nes.ppu.spriteMem = data["spriteMem"];
self.nes.ppu.vramAddress = data["vramAddress"];
Oops, something went wrong.

0 comments on commit 6a772f8

Please sign in to comment.