Better HN
topnewbestaskshowjobs
Log inSign up

bowild

2 karma · joined May 1, 2018 (8y ago) · 4 submissions

Submissions

comment 7y ago · link · parent

This approach moves an `if` statement out of the loop, so there's no need to repeat it.

comment 7y ago · link · parent

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.

comment 8y ago · link · parent

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.

4.

Ruby's Rack Push: Decoupling the real-time web application from the web(bowild.wordpress.com ↗)

4 points · by bowild · 8y ago · discuss