Is there a way to hot deploy room extention??

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

Moderators: Lapo, Bax

BonyYousuf
Posts: 120
Joined: 20 Feb 2011, 12:54

Is there a way to hot deploy room extention??

Postby BonyYousuf » 17 Apr 2011, 07:41

Hi,
I am very new with the whole Smart fox server. So i make a lot of mistakes and do a lot of rewrite and redeploy and restart the server. Which is beginning to be a pain in the neck. I see smartfoxserver automatically reloads Zone Extensions without even reloading the server. However it does not do that for the Room Extensions(or am i missing something?). Can anyone please tell me how i can achieve this same hot deploy functionality with the room extensions as well??
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 17 Apr 2011, 09:41

the room extension exists as long as the room exists.
make it a dynamic room and when the room is empty the extension will be detroyed and the new version will be loaded when a new user enters the room.
Lightnet
Posts: 19
Joined: 13 Apr 2011, 02:01

Postby Lightnet » 23 Apr 2011, 18:22

I am having trouble with the room extensions and I create room in the admin config and added extension. I get the error on there no handler in the ext. It detect the first main ext. entering the server and not the room ext. I am using the untiy3d.

Is there way to set it?
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 23 Apr 2011, 19:34

Your class should extend SFSExtension.
Can you post your extension code ?
Lightnet
Posts: 19
Joined: 13 Apr 2011, 02:01

Postby Lightnet » 23 Apr 2011, 21:58

It made a simple server for it.

main ext

Code: Select all

public class UnityRPGExt extends SFSExtension{
    private World world;

    public World getWorld() {
   return world;
    }

    @Override
    public void init()
    {
        //initdatabase();
        world = new World(this);  // Creating the world model
        trace("Extension -- started");

        addEventHandler(SFSEventType.USER_DISCONNECT, OnUserGoneHandler.class);
        addEventHandler(SFSEventType.USER_LEAVE_ROOM, OnUserGoneHandler.class);
        addEventHandler(SFSEventType.USER_LOGOUT, OnUserGoneHandler.class);
        addEventHandler(SFSEventType.USER_LOGIN, OnUserLoginHandler.class);
        addEventHandler(SFSEventType.USER_JOIN_ROOM, OnUserEnterRoomHandler.class);

    }
}


Lobby room ext:

Code: Select all

public class Unity3DLobbyExt extends SFSExtension{

     @Override
    public void init()
    {
        trace("Unity3DLobbyExt -- started");
        addRequestHandler("Test", Test.class);
        addRequestHandler("ObjectPlayer", ObjectPlayer.class);
        addRequestHandler("creategame", CreateGameHandler.class);
       
        addEventHandler(SFSEventType.USER_JOIN_ROOM, OnUserEnterLobbyHandler.class);
    }

     @Override
    public void destroy()
    {
        super.destroy();
        trace("Unity3DLobbyExt -- stopped");
    }

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

Postby Lapo » 24 Apr 2011, 13:49

You can redeploy the extension at any time.
Rooms currently running will not be affected and will continue to use the old code. New Rooms will use the updated code.
Lapo
--
gotoAndPlay()
...addicted to flash games
Lightnet
Posts: 19
Joined: 13 Apr 2011, 02:01

Postby Lightnet » 24 Apr 2011, 15:34

How to redeploy the extension?

How to deploy the Extension when creating the room?

I am not sure how it code.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 24 Apr 2011, 16:00

When you create a room dynamically from the client, you specify the extension to use.

Try to take a look at either the Tic-Tac-Toe example or the FPS one. They both specify room extension on room creation

Redeploy the extension - simply replace the old jar file on the server with the new one.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Lightnet
Posts: 19
Joined: 13 Apr 2011, 02:01

Postby Lightnet » 24 Apr 2011, 18:25

I have some like this:
SFSUExt
-addEventHandler > login
-addEventHandler > join room

LobbyRoomExt
-addRequestHandler > create room

GameRoomExt
-addRequestHandler > transform

Main zone ext SFSUExt
Lobby room ext LobbyRoomExt
TheGame room ext GameRoomExt

When the user enter the Lobby room. Then I call create room. I get the error that there no handler. It think it in the main. I define my room right.

Then when I remove the LobbyRoomExt from "create room" and add in the SFSUExt to "create room". It work.

client

Code: Select all

smartFox.Send(new JoinRoomRequest(roomName, "", smartFox.LastJoinedRoom.Id));



I just see in the client side. Is there way in server side. When creating the room and ext?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 25 Apr 2011, 09:28

Sounds to me like you have a missing jar file or the class is missing in your jar or you are referencing the wrong class in the room creation.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
Lightnet
Posts: 19
Joined: 13 Apr 2011, 02:01

Postby Lightnet » 25 Apr 2011, 15:29

Do I have to set to join/leave to set the room ext to make it work in the server code?
noping
Posts: 27
Joined: 11 May 2020, 12:38

Hot deployment of extension not working

Postby noping » 08 Dec 2020, 01:17

Hi,

I have been deploying extensions and face the following outcomes

1. sometimes, all goes well, the new extension goes in and existing rooms continue to operate on the old extension
2. other time, I get a server restart, uptimes goes to 00:00:00 (users still connected) and all running rooms start throwing errors "SFSExtentionException: No extensions can be invoked"

I like scenario 1 and hate scenario 2. Seems to be random. Any idea?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Is there a way to hot deploy room extention??

Postby Lapo » 08 Dec 2020, 12:56

Hi,
the last post in this thread was from 2011, it would be best to start a new thread with more details.
Such as :
- what version of the server you're using
- how exactly are you deploying the extension
- is it a Zone Ext or Room Ext?
- Also what errors do you get when the process fails.

I get a server restart, uptimes goes to 00:00:00

We've never heard of "spontaneous restarts" after deploying an Extension. We need more details, such as the log files showing what happened before the restart.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 35 guests