Package lacewing :: Module server :: Class ServerChannel
[frames] | no frames]

Class ServerChannel

source code

object --+
         |
        ServerChannel

Represents a channel.

Instance Methods
 
__init__(self, name, id, hidden, autoClose, master)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
addConnection(self, connection)
Add a client to the channel, and notify the other clients.
source code
 
removeConnection(self, connection)
Remove a client from the channel, and notify the other clients.
source code
 
sendMessage(self, message, subchannel=0, fromConnection=None, asObject=False, typeName=None, **settings)
Send a channel message from the given protocol instance.
source code
 
sendPrivateMessage(self, message, subchannel, sender, recipient, asObject=False, typeName=None, **settings)
Send a message from this client to a recipient
source code
 
sendLoader(self, type, notClients=[], **settings)
Send the specified type to all the clients in the channel, apart from notClients if specified.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  hidden = False
Instance Variables
  id = None
ID of the channel.
  name = None
The name of the channel.
  autoClose = False
True if this channel will close after the master leaves
ServerProtocol object master = None
The master connection of this channel
  connections
List of the clients in the channel.
Properties

Inherited from object: __class__

Method Details

__init__(self, name, id, hidden, autoClose, master)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

addConnection(self, connection)

source code 

Add a client to the channel, and notify the other clients.

Parameters:
  • connection - The protocol instance to add.

removeConnection(self, connection)

source code 

Remove a client from the channel, and notify the other clients.

Parameters:
  • connection - The protocol instance to remove.

sendMessage(self, message, subchannel=0, fromConnection=None, asObject=False, typeName=None, **settings)

source code 

Send a channel message from the given protocol instance.

Parameters:
  • fromConnection - The client that the message is sent from (or None if the message is from the server).
  • message (str/number/ByteReader) - The message to send.
  • subchannel (number) - The subchannel to send the message on.
  • typeName - If not specified, the type will be automatically detected (see lacewing.packetloaders.common.DATA_TYPES for possible values)

sendPrivateMessage(self, message, subchannel, sender, recipient, asObject=False, typeName=None, **settings)

source code 

Send a message from this client to a recipient

Parameters:
  • subchannel - The subchannel of the message in the range 0-256
  • sender (ServerProtocol object) - Sending connection
  • recipient (ServerProtocol object) - Connection to send message to
  • typeName - If not specified, the type will be automatically detected (see lacewing.packetloaders.common.DATA_TYPES for possible values)
  • message (str/number/ByteReader)