Hacker Newsnew | past | comments | ask | show | jobs | submit | bowild's commentslogin

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


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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: