Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Re)connect #22

Open
3 of 5 tasks
luckydonald opened this issue Dec 10, 2015 · 19 comments
Open
3 of 5 tasks

(Re)connect #22

luckydonald opened this issue Dec 10, 2015 · 19 comments

Comments

@luckydonald
Copy link
Member

Starting it besides (and before) a fullscreen running Fallout is difficult, as it doesn't seem to retry connecting...

update:
Steps we need implemented:

(Just tick them when done.)

@rgbkrk
Copy link
Member

rgbkrk commented Dec 11, 2015

We also need to catch when it's connected yet a pipboy is not available yet.

@luckydonald
Copy link
Member Author

Also if the connection breaks. Not sure if that is handled.
edit: implemented with #31

@luckydonald
Copy link
Member Author

I think it would be great if it could display everything even without connection.

So you already load all the components, but have a (re-/dis-)connect button somewhere.
Until connection it would use some cached data, like the mobile app does.
Before first caching, without data use the default values

@luckydonald
Copy link
Member Author

Steps we need implemented:

[moved to top post]

@luckydonald
Copy link
Member Author

I digged a bit in the code. I believe we need to check on the onerrors in
pipboylib.connection.createDiscovery:24
or
pipboylib.connection.createDiscovery:40

This must be possible somehow!

@kitten
Copy link
Contributor

kitten commented Dec 14, 2015

@luckydonald Nope, those errors are just for the discovery. These are btw emitted on the observable, which completes after that. So for example an RxJS observable works like this:

Next => Next => Next => Complete

in our case we might want to complete the observable ourselves to end the discovery. On an error it might looks like this:

Next => Next => Error => Complete

We actually atm use the pipboylib promise wrapper that transforms this discovery observable into a promise that just emits a single server.

The errors that should send us back to the server selection are actually here: https://github.com/RobCoIndustries/pipboylib/blob/master/src/decoding/createObservable.js

@rgbkrk
Copy link
Member

rgbkrk commented Dec 14, 2015

I tinkered with this last night and wasn't really sure how I'd get the disposable from the subscribe.

let d = createDiscovery()
  .bufferWithTime(500)
  .first()
  .subscribe(servers => {
    // stuff
  });

// can't dispose this until completion

Seems like it autodisposes somehow though?

> var d = pbl.connection.createDiscovery().bufferWithTime(500).first().subscribe(function(s) { console.log(s) }); d
AutoDetachObserver {
  isStopped: false,
  observer:
   AnonymousObserver {
     isStopped: false,
     _onNext: [Function],
     _onError: [Function],
     _onCompleted: [Function] },
  m:
   { isDisposed: false,
     current: AutoDetachObserver { isStopped: false, observer: [Object], m: [Object] } } }
> [ { IsBusy: false,
    MachineType: 'PS4',
    info: { address: '192.168.1.71', family: 'IPv4', port: 28000, size: 50 } } ]

> d
AutoDetachObserver {
  isStopped: true,
  observer:
   AnonymousObserver {
     isStopped: true,
     _onNext: [Function],
     _onError: [Function],
     _onCompleted: [Function] },
  m: { isDisposed: true, current: null } }

@kitten
Copy link
Contributor

kitten commented Dec 14, 2015

@rgbkrk This observable in particular is being disposed because it completed. Once an observable sequence is complete there is no need to keep it around. In this case you've used .first() which auto-completes the sequence after the first(n = 1) events.

@rgbkrk
Copy link
Member

rgbkrk commented Dec 14, 2015

@luckydonald worth pointing you towards RxJS, what we're using under the covers for pipboylib.

@rgbkrk
Copy link
Member

rgbkrk commented Dec 14, 2015

@philplckthun Ok, sweet. I'll be using this then later this evening!

@luckydonald
Copy link
Member Author

Above I was actually speaking of the discover & connect to game process, which doesn't seem to happen except on app startup.
Played Fallout a while, the connection text just stayed there, nothing happened. With android I could discover it fine the whole time.

@kitten
Copy link
Contributor

kitten commented Dec 15, 2015

@luckydonald We just have to send the discovery payload multiple times, I guess, as long as there's a subscriber

@luckydonald
Copy link
Member Author

like window.setIntervall(doItAgain, 10*1000 ) ?

@kitten
Copy link
Contributor

kitten commented Dec 15, 2015

@luckydonald Yea, but inside the observable.

@luckydonald
Copy link
Member Author

@philplckthun so inside the library? Wont that break existing code?
Also I'd throw into the discussion: constant every 10 seconds (not that wait-longer-on-fail nonsense)

@luckydonald
Copy link
Member Author

There was some nice diagram in gitter which outlines the connection process
2015-12-16-12.19.17.jpg

@luckydonald
Copy link
Member Author

To better test the discovery locally, there is NimVek/pipboy (python) capable to simulate the PC app.
$ python pipboy.py
PipBoy: start starts the server
PipBoy: stop stop the server
It tends to crash sometimes, just stop and start again.
That should make testing discovery easier, so you don't have to unplug your PS4 every time.

@luckydonald
Copy link
Member Author

Bump.
Edit: Meanwhile I'll try the PyPipboyApp (github)

@rgbkrk
Copy link
Member

rgbkrk commented Feb 12, 2016

That's ok, sorry we haven't been working on it. Got pulled in for some other work in my free time. Thanks for pinging @luckydonald.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants