rgbkrk / pipboyrelay

:zap: Pip boy relay for Fallout 4
79 stars 6 forks source link

Throwing Error on Invalid Listen Type #9

Closed bingeboy closed 8 years ago

bingeboy commented 8 years ago

I'm getting an error when I run the pipboyrelay module on node v0.10.38

Discovered:  { IsBusy: true,
  MachineType: 'PC',
  info: { address: '192.168.1.85', family: 'IPv4', port: 28000, size: 48 } }
[Error: Invalid listen argument: [object Object]]

Steps to recreate:

rgbkrk commented 8 years ago

Sure enough, the TCP Relay fails on node 0.10.

$ nvm use 0.10.38
Now using node v0.10.38 (npm v1.4.28)
$ npm install pipboyrelay

> utf-8-validate@1.2.1 install /Users/kyle6475/code/src/github.com/gunk/node_modules/pipboyrelay/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
  SOLINK_MODULE(target) Release/validation.node: Finished

> bufferutil@1.2.1 install /Users/kyle6475/code/src/github.com/gunk/node_modules/pipboyrelay/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  SOLINK_MODULE(target) Release/bufferutil.node: Finished

> utf-8-validate@1.2.1 install /Users/kyle6475/code/src/github.com/gunk/node_modules/pipboyrelay/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
  SOLINK_MODULE(target) Release/validation.node: Finished

> bufferutil@1.2.1 install /Users/kyle6475/code/src/github.com/gunk/node_modules/pipboyrelay/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  SOLINK_MODULE(target) Release/bufferutil.node: Finished
pipboyrelay@0.1.0 node_modules/pipboyrelay
├── hexy@0.2.7
├── pipboylib@0.3.0 (concentrate@0.2.3, lodash@3.10.1, dissolve@0.3.3)
└── socket.io@1.3.7 (debug@2.1.0, has-binary-data@0.1.3, socket.io-adapter@0.3.1, socket.io-parser@2.2.4, engine.io@1.5.4, socket.io-client@1.3.7)
$ node_modules/.bin/pipboyrelay
Discovered:  { IsBusy: false,
  MachineType: 'PS4',
  info: { address: '192.168.1.71', family: 'IPv4', port: 28000, size: 50 } }
[Error: Invalid listen argument: [object Object]]

I've only been using this with node 4.x and 5.x, happy to have the code adapted to work with old versions of node if it's not too crazy.

bingeboy commented 8 years ago

I'll try and look into the issue this week, maybe add version requirements to the readme.md? Node v0.10.x is quickly becoming dated for those that aren't tied to an enterprise stack.

Thanks for verifying!

ryanm101 commented 8 years ago

Fix is

line 169 in relay/index.js:

this.server.listen({'port': upstreamInfo.port});

should be:

this.server.listen(upstreamInfo.port);

at least that solves the error and i get a connection success on the app. however it then seems to loop in Connecting...

app->pc
00000000: 0000 0000 00

pc->app
00000000: 0000 0000 00

interesting is that while doing that if i tap the screen i get

app->pc
00000000: 0000 0000 05

app -> pc
00000000: 7b22 7479 7065 223a 3134 2c22 6172 6773 {"type":14,"args
00000000: 223a 5b5d 2c22 6964 223a 337d                   ":[],"id":1}

and that "id" increments with each tap

ryanm101 commented 8 years ago

That looping mentioned above still seems to occur even if i drop in node 4 or 5 and revert the fix above.

For reference I'm running Fedora 23

rgbkrk commented 8 years ago

Those are keep alives from app -> Fo4 server, Fo4 server -> app. That second one we've been calling ClearIdle. We're actually all set in having the full protocol diagnosed, check out the new pipboylib repo as well as these spec docs.

ryanm101 commented 8 years ago

Just discovered why i was in that loop aka the keep alives. When the game is running full screen I am getting the data. However when i alt-tab then the stream changes to your keep alives..

you also get them if in the game you enter the pipboy.. which makes it very easy to grab the commands from the app side as they appear admist the keep alives as the only data

rgbkrk commented 8 years ago

Went ahead and fixed up the listen to be backwards compatible, then while I was updating this to the latest version of pipboylib, I noticed that 0.10 does not have Promises or Object.assign. There's not a chance I want to support versions of node that far back with something that's truly new development.

I'll add a version requirement to the package.json and the README.

bingeboy commented 8 years ago

@rgbkrk sounds good to me. Thanks!