-
Notifications
You must be signed in to change notification settings - Fork 37
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
Do we want buffering? #68
Comments
imo this is a fairly obvious footgun — things like writing startup messages immediately and such should be simple. |
@nathan7 agreed, I will make it handle those cases. |
-1 to generic buffering, but +1 to pre-connect buffering. |
Why should those have radically different semantics, @indexzero? |
I don't think they do. Let me rephrase: godot should never do any buffering. The "pre-connect buffering" I was referring to would be the godot instance writing immediately to a net TCP or UDP stream which (thanks to streams2 and streams3) does the buffering for us if we haven't yet connected. |
Yes. Going to close this. We should always write immediately which will be easily buffered by Socket instances returned from net.connect |
@indexzero i brought this up for the case of before we have created a socket but we have a godot client instance. |
Sockets are instantly created by node. They may not immediately connect, but their internal buffering mechanism is available immediately: var sock = net.connect('127.0.0.1', 7731); |
Hmm, I'm thinking the godot client itself should just be a simple stream itself and auto connect when initialized to prevent the need for this |
@indexzero yes but |
Oh yeah? Well that's definitely worth changing. |
Mmmmmmm ... I see the problem here. Maybe we should change the syntax from var client = godot.createClient(options); to var client = godot.connect(options); The difference in semantics here is subtle but important. Overall my goal here is to push the buffering logic onto core as much as possible. |
@indexzero yea i like it. keeps us semantically the same as core and gives an easy way to remove the connect method from the internal client prototype since we would just be constructing a client instance. |
I would actually say keep the connect method on the client instance. The semantic in the docs would be: How does Buffering work in godot?Both the server and client instances of godot do no internal buffering themselves. For connected clients buffering is performed by Node.js core net and dgram modules. Connected clients are created by calling: var client = godot.connect(options); Or var client = godot.createClient(options); I'm not opposed to dropping createClient and the connect prototype method, but we should evaluate if we want to make that kind of breaking change first. |
Can't edit the comment from my phone but the second code sample above should be: var client = godot.createClient(options);
clients.connect(); |
@indexzero we could technically keep it but just have it called in the constructor if we truly want to have buffering handled by the tcp socket (udp won't buffer since its not a stream). I personally say its worth it for simplicity and add it as an extra addition to v1 as we are still in dev there. The other piece I'm thinking about is having |
Do we want to go so far as to implement a fully buffered WritableStream instance in godot? |
@indexzero I'm thinking yes, but at the very least it should be a streams1 stream. From a method standpoint it already meets the requirement. |
the client is the only place i see it making sense. |
Currently the setting is to drop any messages that are written to the client before it connects. This currently works for my use cases but it could be advantageous to buffer these messages to be sent in batch once the client does connect.
Thoughts?
The text was updated successfully, but these errors were encountered: