Re: Django signals to all connections?

2013-08-20 Thread Jani Tiainen
Hi,

Well it seems that you have understood things a bit incorrectly.

First at all, only logged in user is the one accessing some page (a view) from 
Django system.

After that there is nobody logged in traditional sense - there is no simple way 
to detect that user closed browser and was "logged out" nor there is no simple 
way to tell that who is actually even logged in. Most "logged in" counters do 
rely on "less than X time from last action" means active user, whether or not 
that is true.

So what you asked is not possible to do that way. 

That doesn't mean that you can't do it - it would just require a bit more work.

You need two things for that - first you need means to actually store message 
somewhere and secondly you need some mechanism that you check unread messages 
per user return messages in some proper format if there are unread messages and 
mark them read somehow.

That covers serverside work pretty well. Nothing magic just a bit of coding 
work.

In a client you have few options - as you asked for live update you would have 
to have (timed) piece of javascript that in certain intervals pulls messages 
(if any) from server.

There exists other techniques (server push, BOSH, Comet, websockets) as well 
but that is pretty much simplest one to implement.

If you're lucky you can find good examples by gooling for "django web chat" or 
similiar.

On Mon, 19 Aug 2013 06:48:33 -0700 (PDT)
Gerd Koetje  wrote:

> but can it also update a message on a page where that user is without 
> reloading the page?
> 
> lets say user 1 is on page http://www.domain.com/acertainview/
> 
> and at that moment i start a signal as admin with the text hello there
> Can i update the text on his page to that text (live)
> 
> 
> Op maandag 19 augustus 2013 06:29:45 UTC+2 schreef Gerd Koetje:
> >
> > Is is possible to start an event at all connected users with signals?
> > If this is possible can someone show me an example of it.
> >
> >
> > Greetz
> > Gerd
> >
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django signals to all connections?

2013-08-19 Thread Gerd Koetje
but can it also update a message on a page where that user is without 
reloading the page?

lets say user 1 is on page http://www.domain.com/acertainview/

and at that moment i start a signal as admin with the text hello there
Can i update the text on his page to that text (live)


Op maandag 19 augustus 2013 06:29:45 UTC+2 schreef Gerd Koetje:
>
> Is is possible to start an event at all connected users with signals?
> If this is possible can someone show me an example of it.
>
>
> Greetz
> Gerd
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django signals to all connections?

2013-08-19 Thread Rafael Garbin
Yes, always one user logged in, django will look for receiver and running
the method.


2013/8/19 Gerd Koetje 

> omg god bless python/django..
>
>
> So this really works?
>
> user 1 is logged in to my app
> user 2 is logged in to my app
>
> As admin i send a signal with the text hello all and it will be printed on
> the page that user 1 and 2 are on?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Rafael Luís de Souza Garbin
Computer Science Graduate - Software Developer
Linux Counter: Registered user #496288
http://rgarbin.github.com/ 
Phone: 051-96188806

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django signals to all connections?

2013-08-19 Thread Gerd Koetje
omg god bless python/django..


So this really works?

user 1 is logged in to my app
user 2 is logged in to my app

As admin i send a signal with the text hello all and it will be printed on 
the page that user 1 and 2 are on?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django signals to all connections?

2013-08-19 Thread Rafael Garbin
from django.contrib.auth import user_logged_in

@receiver(user_logged_in)
def my_func(...)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django signals to all connections?

2013-08-19 Thread Avraham Serour
maybe you can use a middleware to log access


On Mon, Aug 19, 2013 at 7:29 AM, Gerd Koetje wrote:

> Is is possible to start an event at all connected users with signals?
> If this is possible can someone show me an example of it.
>
>
> Greetz
> Gerd
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Django signals to all connections?

2013-08-18 Thread Gerd Koetje
Is is possible to start an event at all connected users with signals?
If this is possible can someone show me an example of it.


Greetz
Gerd

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.