aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/utils/cmd.go2
-rw-r--r--rpc/ws/server.go (renamed from rpc/websocket/server.go)18
2 files changed, 10 insertions, 10 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 437e0c037..9cdd8b5d1 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -39,7 +39,7 @@ import (
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/rlp"
rpchttp "github.com/ethereum/go-ethereum/rpc/http"
- rpcws "github.com/ethereum/go-ethereum/rpc/websocket"
+ rpcws "github.com/ethereum/go-ethereum/rpc/ws"
"github.com/ethereum/go-ethereum/state"
// "github.com/ethereum/go-ethereum/websocket"
"github.com/ethereum/go-ethereum/xeth"
diff --git a/rpc/websocket/server.go b/rpc/ws/server.go
index f854fe502..9be305b6c 100644
--- a/rpc/websocket/server.go
+++ b/rpc/ws/server.go
@@ -14,14 +14,14 @@
You should have received a copy of the GNU General Public License
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
-package websocket
+package ws
import (
"fmt"
"net"
"net/http"
- ws "code.google.com/p/go.net/websocket"
+ "code.google.com/p/go.net/websocket"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/logger"
@@ -88,23 +88,23 @@ func (self *WebSocketServer) Start() {
func (s *WebSocketServer) apiHandler(xeth *rpc.EthereumApi) http.Handler {
fn := func(w http.ResponseWriter, req *http.Request) {
h := sockHandler(xeth)
- s := ws.Server{Handler: h}
+ s := websocket.Server{Handler: h}
s.ServeHTTP(w, req)
}
return http.HandlerFunc(fn)
}
-func sockHandler(xeth *rpc.EthereumApi) ws.Handler {
- fn := func(conn *ws.Conn) {
+func sockHandler(xeth *rpc.EthereumApi) websocket.Handler {
+ fn := func(conn *websocket.Conn) {
for {
// FIX wslogger does not output to console
wslogger.Debugln("Handling request")
var reqParsed rpc.RpcRequest
- if err := ws.JSON.Receive(conn, &reqParsed); err != nil {
+ if err := websocket.JSON.Receive(conn, &reqParsed); err != nil {
wslogger.Debugln(rpc.ErrorParseRequest)
- ws.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: rpc.ErrorParseRequest})
+ websocket.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: rpc.ErrorParseRequest})
continue
}
@@ -112,12 +112,12 @@ func sockHandler(xeth *rpc.EthereumApi) ws.Handler {
reserr := xeth.GetRequestReply(&reqParsed, &response)
if reserr != nil {
wslogger.Errorln(reserr)
- ws.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: reserr.Error()})
+ websocket.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: reserr.Error()})
continue
}
wslogger.Debugf("Generated response: %T %s", response, response)
- ws.JSON.Send(conn, rpc.RpcSuccessResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: false, Result: response})
+ websocket.JSON.Send(conn, rpc.RpcSuccessResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: false, Result: response})
}
}
return fn