SFS2X communicates with web?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

kencalius
Posts: 16
Joined: 21 Aug 2010, 12:33

SFS2X communicates with web?

Postby kencalius » 27 Mar 2011, 13:41

Sorry if this is confused, cause i'm new at this...

I have a flash app which has buddy list of SFS2X, and a social website which contains this flash app.
The website can also display buddy list somewhere in the web page using PHP/Ajax (or some other web languages)...
I'm leaving the "add buddy" feature for the website, not the flash app. So the website will have the ability for notifying "buddy request", accepting or denying a "buddy request"...
For now i don't know how to achieve this, i can't find a way to communicate with SFS2X using PHP/Ajax... Between, maybe i'm talking about webserver (this is embarrassed :oops: ..)

Please give me some helps?
Thanks!
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 27 Mar 2011, 13:56

Maybe the easier way is that you store your buddy data in a database (so you can update it from you php page), and then, in SFS2X, use a custom buddy list persister class as described at the bottom of this document.
Paolo Bax
The SmartFoxServer Team
kencalius
Posts: 16
Joined: 21 Aug 2010, 12:33

Postby kencalius » 27 Mar 2011, 14:57

Thanks for your reply.
The example i wrote is one of the case that i want the web to communicate with SFS2X.
Some more cases like: a website user chats with another iPhone user; a website user sends "buddy request" to iPhone user, then SFS2X will immediately inform the iPhone user about the buddy request.
I don't know if we can achieve this using Jetty and SFS2X...
So confused :oops:
dmp
Posts: 23
Joined: 28 Aug 2010, 09:22

Postby dmp » 29 Mar 2011, 02:49

i was concerned about this...
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 29 Mar 2011, 09:11

kencalius, we don't know if you can do this using Jetty.
The simplest way is to create a Flash application and add it to your website.
Paolo Bax
The SmartFoxServer Team
dmp
Posts: 23
Joined: 28 Aug 2010, 09:22

Postby dmp » 31 Mar 2011, 15:53

Can you give me any example about servlet/jsp deployed in Jetty can connect SFS2X?
Democre
Posts: 77
Joined: 16 Sep 2010, 17:58

Postby Democre » 01 Apr 2011, 02:34

dmp wrote:Can you give me any example about servlet/jsp deployed in Jetty can connect SFS2X?


Here's a simple servlet written in groovy that merely lists the zones in your smartfoxserver instance. You can do the exact same thing in java, it just takes a little more code:

Code: Select all

import com.smartfoxserver.v2.SmartFoxServer

out << SmartFoxServer.getInstance().zoneManager.zoneList
(Yes, that is the entire servlet :) )

If you wanted to do something with one of your extensions, you'd make the call to
Next I wrote:def ext = SmartFoxServer.getInstance().zoneManager.getZoneByName("myZoneName").extension
and then call methods on that extension such as handleClientRequest.

If you want to call extension methods that you've declared and defined, you should create an interface with those methods, jar that up and stick it in the main lib (for visibilty from your servlet). Create your extension and implement that interface. Then in your servlet you'd just cast the extension to that interface and call its methods.

See this thread: http://www.smartfoxserver.com/forums/viewtopic.php?t=10332

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

Postby Lapo » 18 Sep 2011, 08:41

Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Google [Bot] and 91 guests