Commit d0eee34a authored by haoyanbin's avatar haoyanbin

Fml

parent 826692d0
...@@ -59,8 +59,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ { ...@@ -59,8 +59,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ {
// ) // )
// //
// if err != nil { // if err != nil {
// fmt.Println(5)
// fmt.Println(err)
// return err // return err
// } // }
// return nil // return nil
...@@ -68,7 +66,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ { ...@@ -68,7 +66,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ {
// 2.2 发送消息到队列中 // 2.2 发送消息到队列中
//func (r *RabbitMQ) PublishSimple(message []byte) { //func (r *RabbitMQ) PublishSimple(message []byte) {
// //fmt.Println("push:", string(message))
// //
// err := r.channel.Publish( // err := r.channel.Publish(
// r.Exchange, // r.Exchange,
...@@ -85,8 +82,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ { ...@@ -85,8 +82,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ {
// }, // },
// ) // )
// if err != nil { // if err != nil {
// fmt.Println(6)
// fmt.Println(err)
// return // return
// } // }
// //
......
...@@ -13,7 +13,6 @@ func dump() { ...@@ -13,7 +13,6 @@ func dump() {
return return
} }
wsSever.ErrFun(rcv_err) wsSever.ErrFun(rcv_err)
//log.Error("运行过程中出现异常,错误信息如下:",rcv_err)
} }
func searchStrArray(arr []string, ch string) bool { func searchStrArray(arr []string, ch string) bool {
...@@ -29,7 +28,6 @@ func searchStrArray(arr []string, ch string) bool { ...@@ -29,7 +28,6 @@ func searchStrArray(arr []string, ch string) bool {
func SerializeJson(data interface{}) []byte { func SerializeJson(data interface{}) []byte {
reply, _ := json.Marshal(data) reply, _ := json.Marshal(data)
//fmt.Println(err)
return reply return reply
} }
......
...@@ -245,8 +245,6 @@ func (c *Client) Close() { ...@@ -245,8 +245,6 @@ func (c *Client) Close() {
// 发送消息 只从连接池中按指定的toClientId的连接对象发送出消息 // 发送消息 只从连接池中按指定的toClientId的连接对象发送出消息
// 在此方法中sendMsg.Channel指定的值不会处理 // 在此方法中sendMsg.Channel指定的值不会处理
func Send(msg *SendMsg) error { func Send(msg *SendMsg) error {
//log.Info("发送指令:",msg.Cmd,msg.ToClientId)
if msg.ToClientId == "" { if msg.ToClientId == "" {
return errors.New("发送消息的消息体中未指定ToClient目标!") return errors.New("发送消息的消息体中未指定ToClient目标!")
} }
...@@ -265,7 +263,6 @@ func Send(msg *SendMsg) error { ...@@ -265,7 +263,6 @@ func Send(msg *SendMsg) error {
//} //}
} else { } else {
fmt.Println(1) fmt.Println(1)
//fmt.Println(wsSever.hub.clients)
} }
} }
...@@ -354,8 +351,9 @@ func GetClientInfo(id string) (*UserInfo, error) { ...@@ -354,8 +351,9 @@ func GetClientInfo(id string) (*UserInfo, error) {
tokenData := strings.Split(id, "_") tokenData := strings.Split(id, "_")
fmt.Println(tokenData) //fmt.Println(tokenData)
if len(tokenData) < 4 { if len(tokenData) < 4 {
fmt.Println(tokenData)
return nil, errors.New("用户数据有误") return nil, errors.New("用户数据有误")
} }
......
...@@ -105,7 +105,6 @@ func ws(w http.ResponseWriter, r *http.Request) { ...@@ -105,7 +105,6 @@ func ws(w http.ResponseWriter, r *http.Request) {
fmt.Println("OnMessage:收到出错消息=》", client.Id, msg.Desc) fmt.Println("OnMessage:收到出错消息=》", client.Id, msg.Desc)
return return
} }
//fmt.Println(msg.Msg)
if msg.ToClientId != "" { if msg.ToClientId != "" {
//发送消息给指定的ToClientID连接 //发送消息给指定的ToClientID连接
err := pool.Send(msg) err := pool.Send(msg)
...@@ -115,20 +114,17 @@ func ws(w http.ResponseWriter, r *http.Request) { ...@@ -115,20 +114,17 @@ func ws(w http.ResponseWriter, r *http.Request) {
//发送消息给当前连接对象 //发送消息给当前连接对象
//err = client.Send(msg) //err = client.Send(msg)
//if err != nil { //if err != nil {
// fmt.Println("client.Send(msg):", err.Error())
//} //}
} }
//if len(msg.Channel)>0{ //if len(msg.Channel)>0{
// //按频道广播,可指定多个频道[]string // //按频道广播,可指定多个频道[]string
// err:=pool.Broadcast(msg) //或者 wsPool.Broadcast(msg) // err:=pool.Broadcast(msg) //或者 wsPool.Broadcast(msg)
// if err!=nil { // if err!=nil {
// fmt.Println("pool.Broadcast(msg)", err.Error())
// } // }
//} //}
////或都全局广播,所有连接都进行发送 ////或都全局广播,所有连接都进行发送
//err:=pool.BroadcastAll(msg) //err:=pool.BroadcastAll(msg)
//if err!=nil { //if err!=nil {
// fmt.Println("pool.BroadcastAll(msg)", err.Error())
//} //}
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment