restbed
restbed copied to clipboard
Ability to dependency inject network layer.
Move all ASIO logic into the socket abstraction.
Socket( void );
Socket::listen( port, bind_address, new_connection_callback );
Socket::connect( port, address, success_callback, error_callback );
Socket::write( ..., success_callback, error_callback );
Socket::read( ..., success_callback, error_callback );
Socket::set_option( name, value );
Socket::shutdown( void );
Socket::is_open( void );
Socket::is_closed( void );
static Socket::create( void );
Service::set_network_layer( TCPSocketFactory );
Service::set_network_layer( RS232SocketFactory );
etc...
During this development please remove the io_service and buffer from the request. The Socket should contain all of the ASIO related items.
Given we would have to place all runloop operations in the socket layer after this refactor. Might we want to give it a better name?
Socket::schedule( work );
Maybe:
Runloop runloop;
runloop.schedule( work );
This ticket is rising in priority. With this feature in place we could achieve a far greater set of tests to aid in the validation of the framework logic e.g. confirming WebSocketManager::parse/compose.