I want to send the moderatormessage to all rooms inside the zone

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

Moderators: Lapo, Bax

Akshay
Posts: 1
Joined: 03 Oct 2018, 06:45

I want to send the moderatormessage to all rooms inside the zone

Postby Akshay » 04 Oct 2018, 14:04

I want to send the moderatormessage to all rooms inside the zone
I want to login User from server side using java server api.
I have wrote this code but its giving error .

Code: Select all

               SmartFoxServer sfs1=SmartFoxServer.getInstance();
      sfs1.connect("127.0.0.1",9933);
                  sfs1.send(new LoginRequest("Akshay","Akshay","Chat"));
                SFSEvent event=new SFSEvent(SFSEventType.USER_LOGIN,params);
         System.out.println(event);
           Session session = (Session) event.getParameter(SFSEventParam.SESSION);
           System.out.println("session is : "+session);
            session.setProperty("$permission", DefaultPermissionProfile.MODERATOR);
         User user=sfs.getUserManager().getUserByName("Akshay");
           if(user.isModerator())
         {
            System.out.println("Moderator user");
            MessageRecipientMode mode1=new MessageRecipientMode(MessageRecipientMode.TO_ZONE,null);
            sfs.send(new ModeratorMessageRequest("Hii Every One", mode1));
         }
         else
         {
            System.out.println("Not Moderator");
         }
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: I want to send the moderatormessage to all rooms inside the zone

Postby Lapo » 05 Oct 2018, 07:28

Hi,
unfortunately this is very confusing.
The code you have posted makes no sense, as you are invoking methods that don't even exist.

I would suggest you start from a basic tutorial to learn the fundamentals before you jump into developing more complex things.
You can find all tutorials in our documentation, each platform has its own section:
http://docs2x.smartfoxserver.com/

Also I don't know what you mean by this?
I want to login User from server side using java server api.

Does it mean that you want to use server side code to validate user/password of a client?
Or do you mean you want to create a User from server side? (in other words without an actual connected client)

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

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor and 105 guests