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??
Is there a way to hot deploy room extention??
-
- Posts: 120
- Joined: 20 Feb 2011, 12:54
It made a simple server for it.
main ext
Lobby room ext:
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");
}
}
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
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
Follow on twitter: http://twitter.com/thomas_h_lund
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
I just see in the client side. Is there way in server side. When creating the room and ext?
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?
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
Hot deployment of extension not working
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?
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?
Re: Is there a way to hot deploy room extention??
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.
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
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
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 35 guests