Open luckydonald opened 8 years ago
We also need to catch when it's connected yet a pipboy is not available yet.
Also if the connection breaks. Not sure if that is handled. edit: implemented with #31
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
Steps we need implemented:
[moved to top post]
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!
@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
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 } }
@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.
@luckydonald worth pointing you towards RxJS, what we're using under the covers for pipboylib.
@philplckthun Ok, sweet. I'll be using this then later this evening!
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.
@luckydonald We just have to send the discovery payload multiple times, I guess, as long as there's a subscriber
like window.setIntervall(doItAgain, 10*1000 )
?
@luckydonald Yea, but inside the observable.
@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)
There was some nice diagram in gitter which outlines the connection process
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.
Bump. Edit: Meanwhile I'll try the PyPipboyApp (github)
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.
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.)