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
d1c68f90
Commit
d1c68f90
authored
Jan 11, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redis
parent
82343b50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
client.go
pool/client.go
+1
-1
publicApi.go
pool/publicApi.go
+6
-5
ws_server.go
ws_server.go
+1
-1
No files found.
pool/client.go
View file @
d1c68f90
...
...
@@ -143,7 +143,7 @@ func (c *Client) readPump() {
close
(
c
.
sendPing
)
c
.
grpool
.
Close
()
c
.
hub
.
RemoveClient
(
c
)
DelClient
(
c
.
Id
,
c
.
User
)
DelClient
(
c
.
User
)
dump
()
}()
Loop
:
...
...
pool/publicApi.go
View file @
d1c68f90
...
...
@@ -69,7 +69,8 @@ func NewClient(conf *Config) *Client {
client
.
OnPing
(
nil
)
client
.
OnPong
(
nil
)
wsSever
.
hub
.
AddClient
(
client
)
AppendClient
(
client
.
Id
,
client
.
User
,
string
(
SerializeJson
(
conf
)))
//AppendUser(client.Id, string(SerializeJson(conf)))
AppendClient
(
client
.
User
,
string
(
SerializeJson
(
conf
)))
return
client
}
...
...
@@ -507,13 +508,13 @@ func DelConversation(conversationId int) {
return
}
func
AppendClient
(
client
Id
,
clientUser
,
data
string
)
{
Redis
.
HSet
(
cliKey
+
":"
+
clientId
,
clientUser
,
data
)
func
AppendClient
(
client
,
data
string
)
{
Redis
.
HSet
(
cliKey
,
client
,
data
)
return
}
func
DelClient
(
client
Id
,
clientUser
string
)
{
Redis
.
HDel
(
cliKey
+
":"
+
clientId
,
clientUser
)
func
DelClient
(
client
string
)
{
Redis
.
HDel
(
cliKey
,
client
)
return
}
...
...
ws_server.go
View file @
d1c68f90
...
...
@@ -154,7 +154,7 @@ func ws(w http.ResponseWriter, r *http.Request) {
pool
.
PublishData
(
closeMsg
)
fmt
.
Println
(
"专家关闭连接"
,
client
.
User
)
}
pool
.
DelClient
(
client
.
Id
,
client
.
User
)
pool
.
DelClient
(
client
.
User
)
fmt
.
Printf
(
"连接己经关闭%s"
,
client
.
Id
)
})
...
...
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