Hi,
I have deployed zip file on GPaas which contains logic to create virtual userand I have made changes in ChatServer app to create virtual user. I am passing static room and zone while adding virtual user and it added in room successfully. But now I want to add virtual user in room and zone dynamically. Means from ios I want to pass room and zone and virtual user should be added to that particular room and zone only. Now I'm stuck at this point. How Can I pass custom data to GPaas server to add vitual user in given room and zone?
Code to create virtual user by making changes in ChatServer demo provided by appwarp s2.
1. ChatZoneAdaptor.java:
public void onAdminRoomAdded(IRoom room)
{
//System.out.println("Printing zone from adaptor > " + ChatServerAdaptor.zone);
User user = (User) new VirtualUser("Bot_1", (Room) room, (Zone) ChatServerAdaptor.zone);
room.addUser(user, true);
System.out.println("added virtual user named : " + user.getName() + " ... In room : " + room.getName());
System.out.println("Room Created " + room.getName() + " with ID " + room.getId() );
room.setAdaptor(new ChatRoomAdaptor());
room.BroadcastChat(user.getName(), "Hey! I am Moving");
}
2. ChatServerAdaptor.java:
public class ChatServerAdaptor extends BaseServerAdaptor{
public static IZone zone;
@Override public void onZoneCreated(IZone zone) {
this.zone = zone;
System.out.println("Zone Created By PS == " + this.zone.getName() + " with key " + zone.getAppKey());
zone.setAdaptor(new ChatZoneAdaptor()); }
}