Last change
on this file since 72 was 72, checked in by Bart Vastenhouw, 3 years ago |
Reduced memory need of websockets.
|
File size:
904 bytes
|
Rev | Line | |
---|
[72] | 1 | from abc import ABC, abstractmethod
|
---|
| 2 | from typing import TypeVar, Generic, List
|
---|
| 3 |
|
---|
| 4 | from geniusweb.connection.ConnectionEnd import ConnectionEnd
|
---|
| 5 |
|
---|
| 6 | INTYPE = TypeVar('INTYPE')
|
---|
| 7 | OUTTYPE = TypeVar('OUTTYPE')
|
---|
| 8 |
|
---|
| 9 | class Connectable(ABC, Generic[INTYPE,OUTTYPE]):
|
---|
| 10 | '''
|
---|
| 11 | A Connectable is an object that can connect on request with a provided
|
---|
| 12 | {@link ConnectionEnd} and then respond to incoming and outgong signals.
|
---|
| 13 | @param <INTYPE> the type of incoming messages
|
---|
| 14 | @param <OUTTYPE> the type of outgoing messages
|
---|
| 15 | '''
|
---|
| 16 |
|
---|
| 17 | @abstractmethod
|
---|
| 18 | def connect(self,connection:ConnectionEnd[INTYPE, OUTTYPE] ):
|
---|
| 19 | '''
|
---|
| 20 | creates the connection. Only called if not yet connected.
|
---|
| 21 | @param connection the new connection
|
---|
| 22 | '''
|
---|
| 23 |
|
---|
| 24 | @abstractmethod
|
---|
| 25 | def disconnect(self):
|
---|
| 26 | '''
|
---|
| 27 | Removes the connection from a connectable; the previously given
|
---|
| 28 | connection can not be used anymore after this call. Only called if
|
---|
| 29 | previously connected.
|
---|
| 30 |
|
---|
| 31 | ''' |
---|
Note:
See
TracBrowser
for help on using the repository browser.