Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
im-pool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
im-pool
Commits
d0eee34a
Commit
d0eee34a
authored
Feb 09, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fml
parent
826692d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
15 deletions
+2
-15
simple.go
dao/mq/simple.go
+0
-5
private.go
pool/private.go
+0
-2
publicApi.go
pool/publicApi.go
+2
-4
ws_server.go
ws_server.go
+0
-4
No files found.
dao/mq/simple.go
View file @
d0eee34a
...
...
@@ -59,8 +59,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ {
// )
//
// if err != nil {
// fmt.Println(5)
// fmt.Println(err)
// return err
// }
// return nil
...
...
@@ -68,7 +66,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ {
// 2.2 发送消息到队列中
//func (r *RabbitMQ) PublishSimple(message []byte) {
// //fmt.Println("push:", string(message))
//
// err := r.channel.Publish(
// r.Exchange,
...
...
@@ -85,8 +82,6 @@ func NewRabbitMQSimple(queueName string) *RabbitMQ {
// },
// )
// if err != nil {
// fmt.Println(6)
// fmt.Println(err)
// return
// }
//
...
...
pool/private.go
View file @
d0eee34a
...
...
@@ -13,7 +13,6 @@ func dump() {
return
}
wsSever
.
ErrFun
(
rcv_err
)
//log.Error("运行过程中出现异常,错误信息如下:",rcv_err)
}
func
searchStrArray
(
arr
[]
string
,
ch
string
)
bool
{
...
...
@@ -29,7 +28,6 @@ func searchStrArray(arr []string, ch string) bool {
func
SerializeJson
(
data
interface
{})
[]
byte
{
reply
,
_
:=
json
.
Marshal
(
data
)
//fmt.Println(err)
return
reply
}
...
...
pool/publicApi.go
View file @
d0eee34a
...
...
@@ -245,8 +245,6 @@ func (c *Client) Close() {
// 发送消息 只从连接池中按指定的toClientId的连接对象发送出消息
// 在此方法中sendMsg.Channel指定的值不会处理
func
Send
(
msg
*
SendMsg
)
error
{
//log.Info("发送指令:",msg.Cmd,msg.ToClientId)
if
msg
.
ToClientId
==
""
{
return
errors
.
New
(
"发送消息的消息体中未指定ToClient目标!"
)
}
...
...
@@ -265,7 +263,6 @@ func Send(msg *SendMsg) error {
//}
}
else
{
fmt
.
Println
(
1
)
//fmt.Println(wsSever.hub.clients)
}
}
...
...
@@ -354,8 +351,9 @@ func GetClientInfo(id string) (*UserInfo, error) {
tokenData
:=
strings
.
Split
(
id
,
"_"
)
fmt
.
Println
(
tokenData
)
//
fmt.Println(tokenData)
if
len
(
tokenData
)
<
4
{
fmt
.
Println
(
tokenData
)
return
nil
,
errors
.
New
(
"用户数据有误"
)
}
...
...
ws_server.go
View file @
d0eee34a
...
...
@@ -105,7 +105,6 @@ func ws(w http.ResponseWriter, r *http.Request) {
fmt
.
Println
(
"OnMessage:收到出错消息=》"
,
client
.
Id
,
msg
.
Desc
)
return
}
//fmt.Println(msg.Msg)
if
msg
.
ToClientId
!=
""
{
//发送消息给指定的ToClientID连接
err
:=
pool
.
Send
(
msg
)
...
...
@@ -115,20 +114,17 @@ func ws(w http.ResponseWriter, r *http.Request) {
//发送消息给当前连接对象
//err = client.Send(msg)
//if err != nil {
// fmt.Println("client.Send(msg):", err.Error())
//}
}
//if len(msg.Channel)>0{
// //按频道广播,可指定多个频道[]string
// err:=pool.Broadcast(msg) //或者 wsPool.Broadcast(msg)
// if err!=nil {
// fmt.Println("pool.Broadcast(msg)", err.Error())
// }
//}
////或都全局广播,所有连接都进行发送
//err:=pool.BroadcastAll(msg)
//if err!=nil {
// fmt.Println("pool.BroadcastAll(msg)", err.Error())
//}
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment