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

Class ServerFactory

source code

  twisted.internet.protocol.Factory --+    
                                      |    
twisted.internet.protocol.ServerFactory --+
                                          |
                                         ServerFactory

The server factory.

Instance Methods
 
startFactory(self)
This will be called before I begin listening on a Port or Connector.
source code
 
globalPing(self)
Pings all clients currently connected to the server
source code
str
getWelcomeMessage(self, connection)
This method is called when a connection has been accepted, and a welcome message has to be sent.
source code
 
createChannel(self, name, hidden, autoClose, master) source code
 
destroyChannel(self, channel) source code
 
channelRemoved(self, channel)
Called when a channel has no users in it, and is therefore removed.
source code
 
channelAdded(self, channel)
Called when a new channel is created.
source code

Inherited from twisted.internet.protocol.Factory: __providedBy__, buildProtocol, doStart, doStop, stopFactory

Class Variables
  datagram = None
hash(x)

Inherited from twisted.internet.protocol.Factory: __implemented__, __provides__, noisy, numPorts, protocol

Instance Variables
  channelClass
This is the channel class that will be used when creating a new channel.
  timeOut = 8
The number of seconds the client has to send a Hello packet before being disconnected.
  pingTime = 8
The interval between pings in seconds
  maxPing = None
This is the time the client has to respond to pings (in seconds).
  maxUsers = 1000
The max number of users allowed on the server.
  welcomeMessage = 'Welcome! Server is running pylacewing 1.0 (w...
The message sent to accepted clients.
  ping = True
If True, pinging will be enabled on the server
  channelListing = True
If True, channelListing is enabled on the server
  masterRights = False
If True, this enables the autoclose feature for clients when creating channels
Method Details

startFactory(self)

source code 

This will be called before I begin listening on a Port or Connector.

It will only be called once, even if the factory is connected to multiple ports.

This can be used to perform 'unserialization' tasks that are best put off until things are actually running, such as connecting to a database, opening files, etcetera.

Overrides: twisted.internet.protocol.Factory.startFactory
(inherited documentation)

getWelcomeMessage(self, connection)

source code 

This method is called when a connection has been accepted, and a welcome message has to be sent. The default implementation just returns welcomeMessage, but override this method to change that behaviour.

Parameters:
  • connection (ServerProtocol object) - Connection that has been accepted
Returns: str

channelRemoved(self, channel)

source code 

Called when a channel has no users in it, and is therefore removed.

Parameters:
  • channel - The channel that is being removed.

channelAdded(self, channel)

source code 

Called when a new channel is created.

Parameters:
  • channel - The channel that has been created.

Instance Variable Details

channelClass

This is the channel class that will be used when creating a new channel. Subclass ServerChannel and replace this attribute if you want to change the behaviour of channels.
Value:
lacewing.server.ServerChannel

timeOut

The number of seconds the client has to send a Hello packet before being disconnected. Can be a number or None for no timeout
Value:
8

maxPing

This is the time the client has to respond to pings (in seconds). Can be a number or None for no max ping (default)
Value:
None

welcomeMessage

The message sent to accepted clients.
Value:
'Welcome! Server is running pylacewing 1.0 (win32)'