CrowdHailer / raxx

Interface for HTTP webservers, frameworks and clients
https://hexdocs.pm/raxx
Apache License 2.0
401 stars 29 forks source link

Introduce separate behaviour for streaming and simple cases #143

Closed CrowdHailer closed 5 years ago

CrowdHailer commented 5 years ago

Streaming interfaces never needed to implement a handle_request callback, this included middleware like the router that had a nonsense return to satisfy the compiler warnings about an unimplemented callback. This PR separates the handle_request callback to it's own new behaviour Raxx.SimpleServer To help with the upgrade path use Raxx.Server now requires a type. No type raises an error, this should be helpful in alerting users who upgrade to the changes.

Which should be the preferred style? Both lines below are equivalent.

use Raxx.Server, type: :simple
# or
use Raxx.SimpleServer

This PR requires an update to Ace https://github.com/CrowdHailer/Ace/pull/122

An example of using the new interface can be found in this PR https://github.com/CrowdHailer/watercooler/pull/2

CrowdHailer commented 5 years ago

use Raxx.Server (without any type) mean the streaming server

I would actually like this to be the end case. Just annoying that that is already used to mean the simple server in so many applications. Will investigate some further macro magic, see what warnings I can get

nietaki commented 5 years ago

This will close #138

nietaki commented 5 years ago

Do we need to disable circle CI?