I'm doing this in response to a compilation error on MSVC 2015. As far as I can tell, this is a bug in the compiler. My basis for asserting this is that placing the following declaration within the 'endpoint.on_open = <<lambda>>' gives the same compilation error:
const std::function<void(void)> mycallback = [](void) {};
Whereas moving that logic outside of the 'endpoint.on_open = <<lambda>>' does not give an error.
Normally I don't like working around buggy compilers, but in this case the callback is supposed to be optional anyways.