BenChung / KRPC.jl

A kRPC client for Julia
MIT License
3 stars 4 forks source link

examples #3

Open maartenvd opened 4 years ago

maartenvd commented 4 years ago

It'd be nice to have some examples on how to use the code. Am I correct in that I need to call

kRPC.Remote.SpaceCenter.ActiveVessel()

to get the active vessel? ie that krpc doesn't reexport everything from remote? (I think this can easily be done using a macro)

also the first constructor for connection gets overwritten, and can be dropped (I can write a pull request if you want)

BenChung commented 4 years ago

Sorry, I haven't really prepared this for use by anyone else! Good to hear that someone's trying to use it :). I don't really have time right now to prepare documentation, though, and probably won't for the foreseeable future sadly.

No; kRPC.jl by itself won't import Remote since it doesn't know for sure that it exists when the library itself is loaded and I didn't want to clutter up the namespace. The suggested way to handle this is to add suitable using statements after you open a connection (e.g. using kRPC.Remote.SpaceCenter).

Sure, I'd appreciate a PR for the connection issue.

maartenvd commented 4 years ago

Hi I oppened the pr, can you also briefly explain to me how to write streams? Or is this not really implemented?

BenChung commented 4 years ago

Streams are supported, though listening is rather rudimentary at this point. A stream can be opened by calling add_stream (see streams.jl for reference as to its signature) passing a kPC (which can be constructed through kRPC.Remote.SpaceCenter.Delayed.[your call here] for example). kRPC on the server side doesn't really support "writable" streams per se, so there's no support for doing that here, either.