Ted Patrick > { Events & Community } > Adobe Systems


Help ... PowerSDK Chat Client API

I need your help. We are building a specialized chat server for Flash and wanted to release the Alpha API for public comment. An alpha version of the server will be released next week allowing you to run the server locally and build applications. Any feedback you can provide would be most helpful to me. Please forward comments to ted@powersdk.com.

Thanks,

Ted :)

PSDK:Chat Client API - Alpha Review
-------------------------------------------------------------

// make a server object
myChat = new com.psdk.server.chat()

// connect to a server:port
myChat.connect ('server', 7000)

//login to the server with a username
myChat.login('ted')

There are 2 primary objects, users and rooms. Once you login, these objects appear, populate automatically, and allow you to send and receive messages. Here are a few ways to use the users and rooms objects:

// send a message to 'Fred'
myChat.users.fred.send('Yo what is up!')

// execute a method on freds client
myChat.users.fred.explode('abc',123)

// get info on fred
myChat.users.fred.info()

//Loop through users and send a message to all
for (var a in myChat.users){
myChat.users[a].send('Weeeeeee...')
}

// enter a room - if the room doesn't exist, it will be created automagically
myChat.rooms.hotel.enter()

// send a message to the room
myChat.rooms.hotel.send('This room is great!')

// execute a room method - This goes to all users in the room and executes on the room object
myChat.rooms.hotel.explode('KaBoom!')

// get info on hotel
myChat.rooms.hotel.info()

// exit a room - if you are the last one in the room, it is destroyed automagically
myChat.rooms.hotel.enter()

//Loop through rooms
for (var a in myChat.rooms){
trace(a)
}

When you receive a message, events are fired in several locations depending on the object in question.

1. Add an event to a class

//class for user objects
com.psdk.server.chat.user.prototype.onlogoff = function(){}

//class for room objects
com.psdk.server.chat.room.prototype.onrecieve = function(message){}

2. Add an event to the Chat instance - All events are recieved here
myChat.onlogin = function(){}

3. Add an event to a User or a Room instance

myChat.users.ted.onrecieve = function(message){}
myChat.users.ted.onrecieve = function(message){}

4. Subscribe to events via a listener
myChat.addListener('onclose', this)


Chat instance - onconnect, onclose, onlogin, onlogoff, onenter, onexit, oninfo, onexecute, onrecieve, onerror
Room instance - onenter, onexit, oninfo, onexecute, onrecieve, onerror
User instance - onlogin, onlogoff, onenter, onexit, oninfo, onexecute, onrecieve, onerror
Listeners - onconnect, onclose, onlogin, onenter, onexit, oninfo, onexecute, onrecieve, onerror

The current build of the library adds 2.4Kb to your swf for full functionality. The library will also ship in .as and swf formats to allow runtime importing and use of the server. The client will be open source using a BSD license

About the server:

The server uses a special optimized core that allows us to support many types of socket based protocols including, HTTP, HTTPS, Remoting, RTMP, XMLSockets in a scalable cross platform manner. The core was built independent of the individual servers and allows us to create servers on demand. The individual servers are simply events that render a protocol back to a client via a socket. It is very simple design that allows us to build sophisticated servers in a fraction of the time.

The server will be supported on the following platforms: OSX, Win32, Linux, FreeBSD, BSD. In intial testing, the core was able to support an abusive quantity of connections as follows: Windows:2200 connections, FreeBSD:8000 connections, OSX:6000 connections, Linux:untested. An advanced model of the server will support clustering across many servers.

On the chat server, the protocol is plain text (not xml) thus the messages are very small as methods are single characters space delimited with null byte termination. The chat server does not store any data on the local file system and all processing is in memory making user and room processing very fast.

The price point for the chat server is very low compared to the current market as we will be providing customization services allowing us to tailor the server protocol and client library to a specific application. The default chat server will sell for below $150 and there are no connection / user restrictions. Clustering support will be additional in a later version. Development servers will be free and are restricted to running on the localhost.

Again, any thoughts on the Client API would be most helpful and depending on the feedback might be worth of a free license.

Thanks,

Theodore Patrick - Founder
PowerSDK Software Corp.

0 Responses to “ Help ... PowerSDK Chat Client API ”

Post a Comment



© 2008 Ted On Flex