rpc: various fixes/enhancements

rpc: be less restrictive on the request id
rpc: improved documentation
console: upgrade web3.js to version 0.16.0
rpc: cache http connections
rpc: rename wsDomains parameter to wsOrigins
This commit is contained in:
Bas van Kervel
2016-03-14 09:38:54 +01:00
parent 7e02105672
commit aa9fff3e68
23 changed files with 3440 additions and 648 deletions

View File

@ -88,10 +88,10 @@ func wsHandshakeValidator(allowedOrigins []string) func(*websocket.Config, *http
}
// NewWSServer creates a new websocket RPC server around an API provider.
func NewWSServer(cors string, handler *Server) *http.Server {
func NewWSServer(allowedOrigins string, handler *Server) *http.Server {
return &http.Server{
Handler: websocket.Server{
Handshake: wsHandshakeValidator(strings.Split(cors, ",")),
Handshake: wsHandshakeValidator(strings.Split(allowedOrigins, ",")),
Handler: func(conn *websocket.Conn) {
handler.ServeCodec(NewJSONCodec(&wsReaderWriterCloser{conn}),
OptionMethodInvocation|OptionSubscriptions)