Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
sending Private Messages between users
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Norman Khine  
View profile  
 More options Jan 23 2012, 8:07 am
From: Norman Khine <nor...@khine.net>
Date: Mon, 23 Jan 2012 05:07:53 -0800 (PST)
Local: Mon, Jan 23 2012 8:07 am
Subject: sending Private Messages between users
Hello,
I have recently discovered nowjs and is awesome, thank you!

How do i modify the code so that to exclude the user who is posting
it?

// code from http://www.adityaravishankar.com/2011/10/nowjs-node-js-tutorial-creat...
// Send message to everyone on the users group
everyone.now.distributeMessage = function(message){
    console.log(this.user.clientId);
    //console.log('Received message from '+this.now.name +' in
serverroom '+this.now.serverRoom);
    var group = nowjs.getGroup(this.now.serverRoom);
    group.now.receiveMessage(this.now.name+'@'+this.now.serverRoom,
message);

};

many thanks

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Serlin  
View profile  
 More options Jan 23 2012, 12:25 pm
From: Ian Serlin <i...@ianserlin.com>
Date: Mon, 23 Jan 2012 09:25:04 -0800
Local: Mon, Jan 23 2012 12:25 pm
Subject: Re: [NowJS] sending Private Messages between users

Typically when I have done this in the past I've just ignored it on the
client-side. Unless you're sending huge amounts of text in the message
you're not saving any significant bandwidth by not broadcasting the message
to the user who sent the message. It looks like you're already keeping a
unique name property on each client that's accessible to the client so this
should be easy.

Alternatively, in terms of application flow, if you're talking about just
displaying user messages (as opposed to sending control messages) you could
add the message the user typed to the chat log only after it's received
back from the server, with no filtering, which means you know the message
actually went through.

Sorry if that's not the answer you were looking for. If you really want to
filter on the server-side without a lot of extra lines of code you could
probably do something with http://nowjs.org/doc/symbols/Group#exclude but I
wouldn't recommend it. A real answer to this server-side would be to do
something like now-middleware and being able to hook into the stack where
the server is calling the client (not client calling the server as it is
now) and run your exclusion code that way.

HTH,

Ian Serlin

i...@ianserlin.com
http://u <http://ianserlin.com>seful.io
http://www.linkedin.com/in/ianserlin
@spiceninja


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Norman Khine  
View profile  
 More options Jan 24 2012, 3:05 am
From: Norman Khine <nor...@khine.net>
Date: Tue, 24 Jan 2012 00:05:39 -0800 (PST)
Local: Tues, Jan 24 2012 3:05 am
Subject: Re: sending Private Messages between users
thanks for the reply. sorry i was not clear with my subject title and
the actual post!

there are two questions:

1/. when sending a message, i don't want to display this back to the
user who sent it.
2/. how to deal with PM to one or a set of users?

On Jan 23, 6:25 pm, Ian Serlin <i...@ianserlin.com> wrote:

> Typically when I have done this in the past I've just ignored it on the
> client-side. Unless you're sending huge amounts of text in the message
> you're not saving any significant bandwidth by not broadcasting the message
> to the user who sent the message. It looks like you're already keeping a
> unique name property on each client that's accessible to the client so this
> should be easy.

so this is a use case as per the discussion on github (i think i read
it there) where a user sends a file and we don't want to send the same
file back to the user who sends it!

what i was looking for is to modify:

group.now.receiveMessage(this.now.name+'@'+this.now.serverRoom,
message);

so that it includes the https://github.com/Flotype/now/pull/80#issuecomment-1448994

everyone.exclude([this.user.clientId]).now.receive(this.now.name + ":
" + msg);

i am unsure how to do the:

var group = nowjs.getGroup(this.now.serverRoom);

 and include the .exclude([this.user.clientId])

> Alternatively, in terms of application flow, if you're talking about just
> displaying user messages (as opposed to sending control messages) you could
> add the message the user typed to the chat log only after it's received
> back from the server, with no filtering, which means you know the message
> actually went through.

> Sorry if that's not the answer you were looking for. If you really want to
> filter on the server-side without a lot of extra lines of code you could
> probably do something withhttp://nowjs.org/doc/symbols/Group#excludebut I
> wouldn't recommend it. A real answer to this server-side would be to do
> something like now-middleware and being able to hook into the stack where
> the server is calling the client (not client calling the server as it is
> now) and run your exclusion code that way.

the way i understand it is that this is all done on the server, as the
user sends the 'message' which is then broadcasted to all the users
from the server, but excluding the original poster? perhaps i am
misunderstanding it?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »