News for hackers. Stuff that matters.

bowild

Re:Facil.io: A micro-framework for C web applications on Thursday January 31, 2019 @12:56PM (#19046953)
This approach moves an `if` statement out of the loop, so there's no need to repeat it.
Re:Facil.io: A micro-framework for C web applications on Thursday January 31, 2019 @12:53PM (#19046899)
Actually, it's to allow for non-NUL terminated strings.

A good example is when using a String supplied by a scripting language such as Ruby or JavaScript.

Normally, you might need to copy the string to add a NUL byte, or request that the scripting engine provide a NUL terminated string (which might result in the same action performed).

Using this optional approach, a potential copy of the data can be avoided.

You have great points as far as application architecture is concerned.

However, as far as server architecture goes - even if we separate the application into two different processes (HTTP and WebSockets), the current situation is that the WebSocket server in Ruby will run two IO reactors / "servers" internally (unless you use a custom WebSocket enabled server such as iodine).

This post is more about the way WebSocket servers are implemented using Rack than about the question of application architecture.