Revert "Move gdax message/request to new package"

This reverts commit ee3a0adf74b6861f040944abfc5e6087e4b6436f.
This commit is contained in:
Kevin Cotugno 2017-09-23 17:35:05 -07:00
parent 144ba33b48
commit f7f51884b5
3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
package gdax package tacitus
import ( import (
"github.com/shopspring/decimal" "github.com/shopspring/decimal"

View File

@ -1,4 +1,4 @@
package gdax package tacitus
const Subscribe = RequestType("subscribe") const Subscribe = RequestType("subscribe")
const Unsubscribe = RequestType("unsubscribe") const Unsubscribe = RequestType("unsubscribe")

View File

@ -1,7 +1,7 @@
package websocket package websocket
import ( import (
"github.com/kcotugno/tacitus/gdax" "github.com/kcotugno/tacitus"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
@ -12,9 +12,9 @@ import (
const ENDPOINT = "wss://ws-feed.gdax.com" const ENDPOINT = "wss://ws-feed.gdax.com"
type Client struct { type Client struct {
msgs chan gdax.Message msgs chan tacitus.Message
err chan error err chan error
writer chan gdax.Request writer chan tacitus.Request
conn *websocket.Conn conn *websocket.Conn
conMux sync.Mutex conMux sync.Mutex
@ -24,9 +24,9 @@ type Client struct {
func NewClient() *Client { func NewClient() *Client {
c := Client{} c := Client{}
c.msgs = make(chan gdax.Message, 1024) c.msgs = make(chan tacitus.Message, 1024)
c.err = make(chan error) c.err = make(chan error)
c.writer = make(chan gdax.Request) c.writer = make(chan tacitus.Request)
c.close = make(chan bool) c.close = make(chan bool)
return &c return &c
@ -43,7 +43,7 @@ func (c *Client) Open() error {
go func() { go func() {
for c.connected() { for c.connected() {
var msg gdax.Message var msg tacitus.Message
err := c.conn.ReadJSON(&msg) err := c.conn.ReadJSON(&msg)
if err != nil { if err != nil {
@ -92,13 +92,13 @@ func (c *Client) sendClose(send bool) {
} }
} }
func (c *Client) Send(msg gdax.Request) { func (c *Client) Send(msg tacitus.Request) {
if c.connected() { if c.connected() {
c.writer <- msg c.writer <- msg
} }
} }
func (c *Client) MessageStream() <-chan gdax.Message { func (c *Client) MessageStream() <-chan tacitus.Message {
return c.msgs return c.msgs
} }