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

Feature: bare bones client for sending messages to server #15

Open
rezural opened this issue Dec 10, 2021 · 5 comments
Open

Feature: bare bones client for sending messages to server #15

rezural opened this issue Dec 10, 2021 · 5 comments

Comments

@rezural
Copy link

rezural commented Dec 10, 2021

I am wanting to receive messages on a bevy 'game', which works as advertised, however, i am wanting to create clients are not necessarily running within a bevy run loop, and it is not obvious how this is done.

I tried creating a NetworkClient directly, however it appears that this is intrinsically bound up with code in handle_connection_event, (including setting the net_res.server connection directly, which is private :| ).

This is obviously do-able, but apparently not with NetworkClient, perhaps a StandaloneNetworkClient which includes relevant code from handle_connection_event?

I'm a bit confused at this point, any pointers would be appreciated.

Thanks

@rezural
Copy link
Author

rezural commented Dec 10, 2021

I see there is something like this in the initial commit of NetworkClient. I will have a look at this and see if it fits my needs.

Is this something that you would accept a PR for? i.e. StandaloneNetworkClient, and perhaps a simple example that sends a single message (or something.)

@rezural
Copy link
Author

rezural commented Dec 10, 2021

I made a manual copy of NetworkClient from this commit: b489d17

It appears to work OK, but I'm not sure if the code is actually correct, and/or if there are critical fixes, or if NetworkClient is just more correct in newer versions. (It's alot harder to follow in later versions)

Changes are here: https://github.com/rezural/bevy_spicy_networking/tree/standalone-network-client.

I will put up a PR if you want.

@TheNeikos
Copy link
Contributor

Heya! Thank you. That sounds like a good idea. If you want to, you can send the PR.

@rezural
Copy link
Author

rezural commented Dec 13, 2021

Ok,

I see that the code is changed to avoid the use of block_on(?).

I'm happy with using the StandaloneNetworkClientm but I am wondering if the rework was premeditated as such, or just kinda just what fell out as a result of chasing the tail of async wonderland.

But, yeah, I will send up a PR.

It's a shame that it is so much duplication of code that is basically the same struct, If you have any thoughts on this, I'll keep it in mind.

Thanks

@TheNeikos
Copy link
Contributor

Yeah, the blocking was unnecessary, so I removed it.

I'd be happy to see your approach!

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

2 participants