Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
communications-backbone communications-backbone
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 25
    • Issues 25
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Communications Backbone System
  • communications-backbonecommunications-backbone
  • Merge requests
  • !6

Open
Created 2 years ago by Dan Jones@danjonOwner
  • Report abuse
Report abuse

Draft: Resolve "Add websockets"

  • Overview 0
  • Commits 12
  • Pipelines 3
  • Changes 18

Closes #11

  • Dan Jones @danjon changed milestone to %SoAR-2023W01 2 years ago

    changed milestone to %SoAR-2023W01

  • Dan Jones @danjon added Partner::NOC Status::In Progress labels 2 years ago

    added Partner::NOC Status::In Progress labels

  • Dan Jones @danjon added 7 commits 2 years ago

    added 7 commits

    • 0bfe2e95 - feat: work in progress socket implementation
    • bfbea127 - docs: notes about implementing socket logic
    • db5cf550 - fix: run api and socket on shared port
    • 989c2c6e - fix: handle lost connections cleanly
    • f8ed1438 - feat: listen for websockets connections
    • ee03332c - test: scripts for testing ws send receive
    • 3fb647af - docs: simplify usage for get_token to env var

    Compare with previous version

    Toggle commit list
  • Dan Jones @danjon added 1 commit 2 years ago

    added 1 commit

    • a7934233 - feat: wip wait for authenticated socket

    Compare with previous version

  • Dan Jones @danjon added 91 commits 2 years ago

    added 91 commits

    • a7934233...f987d4dc - 82 commits from branch dev
    • 4340ab77 - feat: work in progress socket implementation
    • 15ef1c33 - docs: notes about implementing socket logic
    • 53b2814a - fix: run api and socket on shared port
    • 4a39ec59 - fix: handle lost connections cleanly
    • 1cfacfb3 - feat: listen for websockets connections
    • 7a4fd2dd - test: scripts for testing ws send receive
    • 4a2e30ce - docs: simplify usage for get_token to env var
    • eef91eb7 - feat: wip wait for authenticated socket
    • 2b47cf1d - fix: tidy up post rebase

    Compare with previous version

    Toggle commit list
  • Dan Jones @danjon added 32 commits 2 months ago

    added 32 commits

    • 2b47cf1d...b9754c55 - 21 commits from branch dev
    • c0eb287c - feat: work in progress socket implementation
    • e783c022 - docs: notes about implementing socket logic
    • 56af4395 - fix: run api and socket on shared port
    • e40e65c1 - fix: handle lost connections cleanly
    • df1d21aa - feat: listen for websockets connections
    • 1b413f8a - test: scripts for testing ws send receive
    • 66a98281 - docs: simplify usage for get_token to env var
    • 56e226db - feat: wip wait for authenticated socket
    • 07d0646c - fix: tidy up post rebase
    • e2e861ee - fix: fixup after rebase needs testing
    • 3b0ed55a - fix: fixup refactored api after rebase

    Compare with previous version

    Toggle commit list
  • Dan Jones @danjon added 1 commit 2 months ago

    added 1 commit

    • 86b61a8f - fix: remove unused imports

    Compare with previous version

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Viewing commit e783c022
Prev Next
1 file
+ 14
- 5
Show latest version
    File browser
    Compare changes
  • e783c022
    Dan Jones
    docs: notes about implementing socket logic · e783c022
    Dan Jones authored 2 years ago
api_wrap_socket.py
+ 14
- 5
  • View file @ e783c022

  • Edit in single-file editor

  • Edit in Web IDE


Files with large changes are collapsed by default.

Show all unchanged lines Show 20 lines
parsed = self.token.validate(token)
print(str(parsed))
if parsed['valid']:
# client = self.clients.get(parsed['client_id'])
# if client:
# self.client = client
allow = True
client = self.clients.get(parsed['client_id'])
if client:
self.client = client
allow = True
return allow
def onOpen(self):
Show 20 lines Show all unchanged lines Show 20 lines
print("Client connecting: {}".format(request.peer))
allow = self.auth(request)
print(f"Allowed: {allow}")
# if allow:
# setup queue consumer
def onMessage(self, payload, isBinary):
if not isBinary:
if (msg := payload.decode("utf-8")).startswith("@a"):
self.factory.broadcast("Got message: " + msg)
# identify client
# deliver to client-outbox rmq
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
Show 20 lines Show all unchanged lines Show 20 lines
print("broadcasting message '{}' to {} clients ...".format(msg, len(self.clients)))
for cid in self.clients:
self.clients[cid].sendMessage(msg.encode('utf-8'))
def deliver(self, cid, msg):
print("delivering message '{}' to {} client ...".format(msg, cid))
if cid in self.clients:
self.clients[cid].sendMessage(msg.encode('utf-8'))
def run():
ServerFactory = SubscriptionServerFactory
factory = ServerFactory("ws://localhost:9000")
factory = ServerFactory("ws://localhost:8088")
factory.protocol = SubscriptionServerProtocol
listenWS(factory)
Show 20 lines Show all unchanged lines
Assignee
Dan Jones's avatar
Dan Jones
@danjon
Assign to
0 Reviewers
None
Request review from
SoAR-2023W01
Milestone
SoAR-2023W01 (Past due)
Assign milestone
None
Time tracking
No estimate or time spent
2
Labels
Partner::NOC Status::In Progress
Assign labels
  • No matching results
  • Manage project labels
Lock merge request
Unlocked
1
1 participant
user avatar
Reference: communications-backbone-system/communications-backbone!6
Source branch: 11-add-websockets

    0 pending comments