Page 1 of 1

Send Private Message to a list of Users

Posted: 13 Sep 2013, 10:23
by wulei
Hi everyone !

I didn't find any answers to my problem in this forum

I am disappointed by the private message request:

why don't change this
*

Code: Select all

public PrivateMessageRequest(
	string message,
	int recipientId,
	ISFSObject parameters
)
*
into this
*

Code: Select all

public PrivateMessageRequest(
	string message,
	int[] recipientsIds,
	ISFSObject parameters
)
*
?

First I want a client be able to sent a private message to several users in one shot (concept of private discussions), instead of sending a burst of requests to the server for one private message in the discussions.

Second i want the server be able to intercept each message to add some data like the current time and some others. I saw this topic http://forums.smartfoxserver.com/viewto ... ers#p62548 where it seems to be not possible.


Finally have I to do my own extension ? Or is there any other alternative ?
Thanks for helping and any answers

PS:
1. Is there a way to use "ISFSObject parameters" in private message request to ask the server to broadcast the message to the concerned clients ?

2. why don't turn public and private message requests into a single request like :

Code: Select all

public MessageRequest(
	string message, // The text
	int[] recipientsIds, // The concerned users limited to a definable number
	bool IsPublic, //Is this a private or public message
	ISFSObject parameters // How to use this
)
3. or just defined via a request a list of users referenced by an id. The id is assigned by the server.
Then the message request can be like that:

Code: Select all

public MessageRequest(
	string message, // The text
	int GroupOfUsers_ID, // The id of the group of users
	bool IsPublic, //Is this a private or public message
	ISFSObject parameters // How to use this
)
4. How in this case the server can maintain a reference on an instance like a group of users ?
Via a database, text files, or in memory like using static variables ?

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 11:40
by Lapo
The idea is that a private message is sent to one other recipient.
A multi-user private discussion sounds like a pretty strange idea, at least it's a very custom request. Which is understandable.

Normally you would gather those people in a Room and let them chat together with Public messages.

In any case, let's talk about solutions. You can use the ObjectMessage instead which supports a custom list of users.
Second i want the server be able to intercept each message to add some data like the current time and some others. I saw this topic http://forums.smartfoxserver.com/viewto ... ers#p62548 where it seems to be not possible.
That thread is 1+ year old. It is now possible to intercept and manipulate most common requests by using a SystemController Filter.
Details here:
http://docs2x.smartfoxserver.com/Advanc ... er-filters

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 12:05
by wulei
Thanks for reply !
I will try that.

So rooms can be deemed as channel of discussion ?

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 12:36
by Lapo
Absolutely, that's what they were created in the first place :)
You can setup a room for a number of user to play a game, to chat about something specific etc...

One-to-one discussion can be done even without a Room, if you so desire. For more users a Room is definitely the best choice. Also you can join as many Rooms as you need, so multiple separate discussions can be handled as well.

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 12:59
by wulei
Thanks again, i really appreciate your help

So i can use rooms and groups of rooms for multiple purposes like:
- group of rooms named : virtual_places_group (restricted to one registration at the same time for each user),
- group of rooms named : channels_of_discussion (several registrations for each user, and each room has its own capacity controlled by the server)

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 13:24
by Lapo
I am not sure what the registration is referring to exactly, but yes they can be used like that.
For more detail I would recommend the documentation:
http://docs2x.smartfoxserver.com/Develo ... chitecture

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 13:45
by wulei
I am not sure but is this correct ?
- a client can subscribed / unsubscribed to a room
- a client can subscribed / unsubscribed to a group of rooms

edit: Just forget about it, i just understand
  • A client can join several rooms
    A client can subscribed to several Groups of rooms
Registration was about the subscribing of a client to a room or group :D
Sincerely thanks for you answer !

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 14:19
by wulei
PS :
And the last strange question but not least :
Is a client is able to
  • subscribe another client to a group of rooms
    make a client join a room
if the logic allows it ?

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 15:20
by Lapo
wulei wrote:A client can join several rooms
Yes
A client can subscribed to several Groups of rooms
Yes
Is a client is able to subscribe another client to a group of rooms
No, it would violate security. Only server side code can do that
Is a client is able to make a client join a room.
Same as above

Re: Send Private Message to a list of Users

Posted: 13 Sep 2013, 15:56
by wulei
Ok
Thanks a lot for answers and help