aboutsummaryrefslogtreecommitdiffstats
path: root/websocket
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-10 07:51:56 +0800
committerobscuren <geffobscura@gmail.com>2015-01-10 07:51:56 +0800
commite3da85faedf21a3ddb73a0fa29decf65364e6c39 (patch)
tree516faf70a5346bec9016bbdd308b6bcc23d5bccb /websocket
parent491c23a728e4f5cdedfa040aded6a6b136f6bee0 (diff)
downloaddexon-e3da85faedf21a3ddb73a0fa29decf65364e6c39.tar
dexon-e3da85faedf21a3ddb73a0fa29decf65364e6c39.tar.gz
dexon-e3da85faedf21a3ddb73a0fa29decf65364e6c39.tar.bz2
dexon-e3da85faedf21a3ddb73a0fa29decf65364e6c39.tar.lz
dexon-e3da85faedf21a3ddb73a0fa29decf65364e6c39.tar.xz
dexon-e3da85faedf21a3ddb73a0fa29decf65364e6c39.tar.zst
dexon-e3da85faedf21a3ddb73a0fa29decf65364e6c39.zip
Implemented filter for ws + fixes
* proper 0xhex * filters fixed * start of filter manager * accounts for ws. Closes #246
Diffstat (limited to 'websocket')
-rw-r--r--websocket/client.go8
-rw-r--r--websocket/message.go9
2 files changed, 12 insertions, 5 deletions
diff --git a/websocket/client.go b/websocket/client.go
index db2c8e5c9..340a67aea 100644
--- a/websocket/client.go
+++ b/websocket/client.go
@@ -51,7 +51,13 @@ func (c *Client) Conn() *ws.Conn {
}
func (c *Client) Write(data interface{}, id int) {
- msg := &Message{Id: id, Data: data}
+ c.write(&Message{Id: id, Data: data})
+}
+func (c *Client) Event(data interface{}, ev string, id int) {
+ c.write(&Message{Id: id, Data: data, Event: ev})
+}
+
+func (c *Client) write(msg *Message) {
select {
case c.ch <- msg:
default:
diff --git a/websocket/message.go b/websocket/message.go
index 73b47456f..cd2af5099 100644
--- a/websocket/message.go
+++ b/websocket/message.go
@@ -3,10 +3,11 @@ package websocket
import "github.com/ethereum/go-ethereum/ethutil"
type Message struct {
- Call string `json:"call"`
- Args []interface{} `json:"args"`
- Id int `json:"_id"`
- Data interface{} `json:"data"`
+ Call string `json:"call"`
+ Args []interface{} `json:"args"`
+ Id int `json:"_id"`
+ Data interface{} `json:"data"`
+ Event string `json:"_event"`
}
func (self *Message) Arguments() *ethutil.Value {