Notification of messages in Zone Extension

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Notification of messages in Zone Extension

Postby Pippoflash » 17 Feb 2006, 14:41

Hey :)
I am facing this issue: I have to save in a DB the last 10 messages of a dynamic room. This room will be destroyed everytime the last user leaves it.

I thought toi create a zone level extension, which will save the last 10 public messages. But I checked and there is no such event in extensions...

Is there a way to intercept the onPublicMessage() issued by clients in an extension?

thx thx thx
P
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 17 Feb 2006, 15:09

Is there a way to intercept the onPublicMessage() issued by clients in an extension?


At the moment no. Dispatching events on every single public message could affect the server peformance, especially with many hundreds of rooms and many thousands of clients connected.

Maybe you can just replace the sendPublicMessage, with your own version that will also store the data into the database

:)
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 17 Feb 2006, 15:18

Yes I was thinking about that...
not really sure... I am concerned about bandwidth...

An idea was to replace the sendPublicMessage() unsing a sendXt... in "str" format, that will then be broadcasted back by the extension to all users in that room, and at the same time the extension will write it in the DB.

But I am concerned by the use of a server side EXt to manage many room chats at the same time... I suspect that an interpreted script stresses the server much more than native sendPublicMessage command...

do you have any suggestion?
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 17 Feb 2006, 15:33

I suspect that an interpreted script stresses the server much more than native sendPublicMessage command...


Probably it will stress a little bit more... but I wouldn't bet.
The script is not interpreted ... surprise! :) The script is compiled 8)

When the extension is loaded by the server it is compiled in native java bytecode. Sure it won't run at the same speed of a pure 100% java class but for a simple operation like that you probably won't see the difference.

I would not reccomend to use the "str" format. We use the "%" symbol as internal separator. If your text message contains those symbols you will probably have problems parsing the data.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 17 Feb 2006, 15:40

whoa that's great :)
it makes me sleep better... actually I already have a room extension running on all rooms...

So whenevr I send a "str" thing, I should not include the character "%" in contents right? good to know...

Ok, then I will write my own public chat :)

thx!
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 17 Feb 2006, 15:51

actually I already have a room extension running on all rooms...


A consideration about this: if you plan to have lots of rooms being created and destroyed I wouldn't reccomend this.

Each time a new room is created the Room Level extension will need to be loaded and compiled. This adds a certain overhead to the server and if many rooms are continuosly added and removed, the server will be constantly work on compiling extensions.

As we suggest in our docs a Zone Level extension is best suited for this type of tasks

Lapo
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 25 guests