-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from dbluhm/refactor/backend-interface
refactor: backend interface
- Loading branch information
Showing
11 changed files
with
134 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3' | ||
|
||
services: | ||
socketdock: | ||
build: .. | ||
ports: | ||
- "8765:8765" | ||
volumes: | ||
- ../socketdock:/usr/src/app/socketdock:z | ||
command: > | ||
--bindip 0.0.0.0 | ||
--backend loopback | ||
--message-uri https://example.com | ||
--disconnect-uri https://example.com | ||
--endpoint http://socketdock:8765 | ||
--log-level INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
"""Backend interface for SocketDock.""" | ||
|
||
from abc import ABC, abstractmethod | ||
from typing import Union | ||
from typing import Dict, Union | ||
|
||
|
||
class Backend(ABC): | ||
"""Backend interface for SocketDock.""" | ||
|
||
@abstractmethod | ||
async def socket_connected(self, callback_uris: dict): | ||
async def socket_connected( | ||
self, | ||
connection_id: str, | ||
headers: Dict[str, str], | ||
): | ||
"""Handle new socket connections, with calback provided.""" | ||
raise NotImplementedError() | ||
|
||
@abstractmethod | ||
async def inbound_socket_message( | ||
self, callback_uris: dict, message: Union[str, bytes] | ||
self, | ||
connection_id: str, | ||
message: Union[str, bytes], | ||
): | ||
"""Handle inbound socket message, with calback provided.""" | ||
raise NotImplementedError() | ||
|
||
@abstractmethod | ||
async def socket_disconnected(self, bundle: dict): | ||
async def socket_disconnected(self, connection_id: str): | ||
"""Handle socket disconnected.""" | ||
raise NotImplementedError() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.