Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flightmate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wclo2
flightmate
Commits
bd523bdc
Commit
bd523bdc
authored
7 years ago
by
wclo2
Browse files
Options
Downloads
Patches
Plain Diff
fix socket send
parent
4e97fc85
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webapp/helper.py
+3
-1
3 additions, 1 deletion
webapp/helper.py
webapp/views.py
+2
-3
2 additions, 3 deletions
webapp/views.py
with
5 additions
and
4 deletions
webapp/helper.py
+
3
−
1
View file @
bd523bdc
...
...
@@ -29,7 +29,9 @@ def tcpSender(message):
try
:
fd
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
fd
.
connect
((
SERVER_IP
,
SERVER_PORT
))
fd
.
sendall
(
message
)
tosend
=
message
.
encode
(
'
utf-8
'
)
print
(
"
message to websocket server:
"
,
tosend
)
fd
.
sendall
(
tosend
)
except
:
print
(
"
send error
"
)
fd
.
close
()
...
...
This diff is collapsed.
Click to expand it.
webapp/views.py
+
2
−
3
View file @
bd523bdc
...
...
@@ -274,9 +274,8 @@ def message(request):
#send to websocket server
#get other members in chatroom, currently we support only 2 members in a room
re
=
ChatRelation
.
objects
.
filter
(
room
=
chatRoom
).
exclude
(
user
=
user
)
memberMail
=
re
[
0
].
user
.
email
print
(
"
message to websocket server:
"
,
room_id
+
"
|
"
+
memberMail
+
"
|
"
+
content
)
tcpSender
(
room_id
+
"
|
"
+
memberMail
+
"
|
"
+
content
)
receiver
=
re
[
0
].
user
tcpSender
(
receiver
.
email
+
"
|
"
+
receiver
.
name
+
"
|
"
+
room_id
+
"
|
"
+
content
)
return
JsonResponse
(
RES_SUCCESS
)
elif
action
==
"
search
"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment