Re: Django Channels: best way to launch multiple workers

2024-08-09 Thread Duane Hilton
Is there any update on this? Do we have any recommendations now on how many workers can run on a server? On Tue, Oct 10, 2017 at 5:00 AM Andrew Godwin wrote: > I don't have enough hard data to give a recommendation, unfortunately. > > Andrew > > On Mon, Oct 9, 2017 at 7:14 PM, Piet van Leeuwen

Re: Django Channels and multi-tenant will this be a world of hurt?

2024-01-27 Thread David Emanuel Sandoval
Just like the one they posted, but with a few minor changes: async def __call__(self, scope, receive, send): and: return await self.inner( dict(scope, schema_name=schema_name, multitenant=True), receive, send ) Also, check if AuthMiddleware is using the channels.auth.get_user() function within

Re: Django Channels and multi-tenant will this be a world of hurt?

2024-01-27 Thread David Emanuel Sandoval
To identify the tenant i used a middleware that extract the tenant from the domain. El sáb, 27 ene 2024, 10:28, Nagaraja escribió: > Y cnt u use pusher instead of channels > > On Sat, 27 Jan, 2024, 4:40 pm 'Sebastián García' via Django users, < > django-users@googlegroups.com> wrote: > >> Hi, I'

Re: Django Channels and multi-tenant will this be a world of hurt?

2024-01-27 Thread Nagaraja
Y cnt u use pusher instead of channels On Sat, 27 Jan, 2024, 4:40 pm 'Sebastián García' via Django users, < django-users@googlegroups.com> wrote: > Hi, I'm reviving this old thread... do you know of any other solution to > the one proposed by @Ahmed Ishtiaque > > Thanks > El domingo, 24 de febrer

Re: Django Channels and multi-tenant will this be a world of hurt?

2024-01-27 Thread 'Sebastián García' via Django users
Hi, I'm reviving this old thread... do you know of any other solution to the one proposed by @Ahmed Ishtiaque Thanks El domingo, 24 de febrero de 2019 a la(s) 9:13:30 p.m. UTC-3, Ahmed Ishtiaque escribió: > @N Muchai, > > I don't know if you've found a workaround to this, but here's mine if >

Re: Django Channels with Queue (Lobby) Manager

2023-07-11 Thread Alec Delaney
Nicee On Tue, Jul 11, 2023, 11:56 AM Alex R wrote: > Hello dear Community! > > I need help with Django channels and Websockets (i guess) for an > application I am building. The project is online Chess game with Django as > a backend and vanilla JavaScript (ajax, jQuey and some bootstrap). We are

Re: Django Channels 2 Group_send to channel layer causes runtime error: "got Future attached to a different loop"

2023-03-22 Thread raed
how did you test it ? did you use a specific cmd to excute ? Le vendredi 16 février 2018 à 22:08:55 UTC+1, Luke Hebert a écrit : > Trying to call the "alert_receive" consumer method > > import json > from channels.consumer import SyncConsumer > from channels.exceptions import StopConsumer > from

Re: Django channels scalling

2022-12-29 Thread Angel Galicia Sp
>From my point of view, You should avoid multi ws connections per client, the purpose of a ws connection is to be able to send data when something happens without a new user request, that being said... I think that the way DJ Channels is built makes it difficult to have just one connection per

Re: Django channels scalling

2022-12-21 Thread Divit Rao
Thanks mate On Wednesday, December 21, 2022 at 9:55:33 PM UTC+5:30 shahee...@gmail.com wrote: > Generally, as you may know, it is not very easy to get memory usage stats > on Unix/Linux without specialised tooling. > > However, in my experience, with default TCP settings, the kernel overhead

Re: Django channels scalling

2022-12-21 Thread Shaheed Haque
Generally, as you may know, it is not very easy to get memory usage stats on Unix/Linux without specialised tooling. However, in my experience, with default TCP settings, the kernel overhead plus whatever "typical" app overhead will not often exceed say 100 kB per connection. Now, we had original

Re: Django channels and web rtc

2022-10-31 Thread ome chukwuemeka
I also need such a resource. I have looked online and couldn't find any. If you come across any useful information, please let me know On Mon, Oct 31, 2022 at 12:10 PM krishna soni wrote: > Anyone have any resources about how to share screen in a group through > django channels via Webrtc?? > >

Re: Django Channels

2020-11-05 Thread Damanjeet Singh
Hello, Please add console.log() in html page and check when client was connected and disconnected. I confirm chat message example works good. Regards On Wed, 4 Nov 2020, 08:55 Yeddu Prasad, wrote: > Hi all, I am trying to learn to setup a django chat using channels. I > tried the Channels tuto

Re: Django channels handshake failed

2020-08-06 Thread Damanjeet Singh
Please also check security in redis. I can confirm chat example in channel working fine for me. I have been using redis, channel, django, ajax, and handsontable for multiple users edit same spreadsheet. On Thu, 6 Aug 2020, 18:54 Kunal Solanke, wrote: > Make sure ur cache db is running redis if

Re: Django channels handshake failed

2020-08-06 Thread Kunal Solanke
Make sure ur cache db is running redis if you are using thay On Thu, Aug 6, 2020, 22:57 shreeh...@gmail.com wrote: > When i try to connect to the socket with js(from chrome console), > handshake fails. when i try to connect the same port using > websocket-client(python), it connects without any

Re: [django-channels] How to close websocket connection from server?

2020-04-19 Thread krnrrr
another thing I managed to think of is send specific message to a specific room of a user, like: async_to_sync(channel_layer.group_send)("238", {"type": "send_text", "text": "close"}) and check in consumer's handler: async def send_text(self, event): if event == "close":

Re: [django-channels] How to close websocket connection from server?

2020-04-19 Thread krnrrr
i gave it another shot and still don't get it. when I connect the first time i have: - browser A which serves as a source of "connect" command - AsyncJsonWebsocketConsumer which handles group_add, accepting incoming socket and setting the "connection A" when I have a call from the other browser

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread Roger Gammans
You don't have to send the messages all the way to the client (browser), you can handle them directly in the consumer still on the serverside. As far as I know you'll have to keep track of metadata like all users connections yourself, but you have the connect(), disconnect() method pair to put your

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread krnrrr
thank you for the help. I need to try it out. i think it's more down the "tell-clients-to-tell-me-to-close" route which i wanted to escape. however, i still don't understand how i can get ALL connections of a user knowing only his token. i mean, when i have an event in the system, i want to not

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread Roger Gammans
I think you are looking at it from the wrong direction. Think about it in terms of consumers/connections, not in terms of users,and in terms of send receiving events. When in your consumers connect method, you subscribe (eg self.channel_layer.group_add() ) to add appropriate group to send user glo

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread krnrrr
well, how I see it: - a user can subscribe to any amount of groups during the lifecycle of his JWT - how can I get a list these groups in the first place? so to be able to "send a message to an appropriate group"? I thought there's a way to decode JWT, get user ID from it and then somehow: cha

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread Roger Gammans
Don't you just have to send a message to an appropriate group which contains just that users/sessions connections/consumers and in the message handler on the consumer call 'self.close()' and remove the consumer from any subscriptions. If I understand the docs, in the disconnect method is still ca

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread krnrrr
or maybe any example of "superuser with groups: he can list all connections and close them if he likes"-type of application. All i found was some types of chats, but none of them included some kind of "chat-admin" with management of the rooms and visitors -- You received this message because y

Re: Django Channels inifnate group expair time or any alternative solution

2020-02-18 Thread Integr@te System
Hi Naveen, Plz look at autobahn lib for all your purpose: https://crossbar.io/autobahn/ On Tue, Feb 18, 2020, 12:16 pot-potato wrote: > Dear Django-Team, > > I trying to create an IoT application with Django Channels, this is my plan > >- I have is a python program that can fetch data fro

Re: Django Channels Redis: MaxClientsError

2020-02-08 Thread Sabuhi Shukurov
hello, have you solved this issue? On Saturday, 6 July 2019 15:55:26 UTC+4, Cédric Foellmi wrote: > > Hello everyone. I am seeking some help with Django Channels and Redis. > > I have a Django app running on Heroku. This app is rather simple: a Daphne > server, a background worker and a scheduli

Re: [django-channels] I want to use aioredis connection pool ,not create new connection in every AsyncWebsocketConsumer.connect .Where can I put the code.

2020-02-04 Thread Nathan Jones
Hi, Did you ever work out how to do this? The only way I could work out how to use a shared pool was to go back to the regular sync `redis` library and use sync_to_async, for example `settings.py` REDIS_PRO_POOL = redis.ConnectionPool(host='localhost', port=6379, db=3) `consumer.py` class T

Re: Django Channels persistent DB connection

2019-11-15 Thread Adam Hooper
On Friday, November 15, 2019 at 2:02:51 PM UTC-5, ajoeiam wrote: > > If I want a connection to the database but want it for only the time > the customer (query source) is logged in - - - how do I specify that? > (So I don't want the connection to be timed - - - would rather the > connection was

Re: Django Channels persistent DB connection

2019-11-15 Thread o1bigtenor
On Fri, Nov 15, 2019 at 12:53 PM Adam Hooper wrote: > > On Wednesday, October 30, 2019 at 12:17:54 PM UTC-4, BR wrote: >> >> I moved from a local sqlite3 DB file to a shared remote (local LAN) MariaDB >> server and noticed a bit of a slow down. On top of the DB now being remote, >> I'm also usin

Re: Django Channels persistent DB connection

2019-11-15 Thread Adam Hooper
On Wednesday, October 30, 2019 at 12:17:54 PM UTC-4, BR wrote: > > I moved from a local sqlite3 DB file to a shared remote (local LAN) > MariaDB server and noticed a bit of a slow down. On top of the DB now being > remote, I'm also using SSL to encrypt the DB information. Based on the > descript

Re: Django-Channels with 2 applications

2019-11-04 Thread Daniel Carvalho
I've seen the docs already. In fact, 3 people from my team have seen it and tried to do what I'm trying to accomplish. We're at a point where we are either missing something or the Channels is not capable of what we need. Thank you in advance for any help! segunda-feira, 4 de Novembro de 2019

Re: Django-Channels with 2 applications

2019-11-04 Thread Integr@te System
Hi Idea man, You can acknowlegdes and try it: https://channels.readthedocs.io/en/latest/ On Mon, Nov 4, 2019, 19:11 Daniel Carvalho wrote: > Hello! > > > I'm trying to make an example to test if it is possible to have 2 > independent django apps connected to the same channel from django-chann

Re: Django Channels persistent DB connection

2019-10-30 Thread BR
I should add: My interest would be to have a DB connection that lasts the lifetime of the parent consumer. Does it already do this, and am I imagining things? On Wednesday, October 30, 2019 at 12:17:54 PM UTC-4, BR wrote: > > I moved from a local sqlite3 DB file to a shared remote (local LAN) >

Re: django channels daphne static files

2019-07-03 Thread Sanjeev
Any fix to this problem or what could be the underlying issue here? Got one today while trying to deploy to heroku Help is appreciated -- 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

Re: Django channels on IIS

2019-06-15 Thread Daniel Butler
My plan to get this to work is to have daphine handle websockets and iis normal http. I don’t know how to configure iis to allow that though. Any ideas or direction would be much appreciated On Sat, Jun 15, 2019 at 9:36 AM Daniel Butler wrote: > No you haven’t missed anything I spoke too soon. I

Re: Django channels on IIS

2019-06-15 Thread Daniel Butler
No you haven’t missed anything I spoke too soon. I was able to get the regular site running using fastcgi. I hope to revisit this once the regular site is in production. It’s too bad we are on Windows server R2 -- You received this message because you are subscribed to the Google Groups "Djang

Re: Django channels on IIS

2019-05-24 Thread Roger Gammans
On Thu, 2019-05-23 at 22:17 -0700, Daniel Butler wrote: > It looks like I found my key I had to install the application module > CGI then use this library to get everything to work! > https://pypi.org/project/wfastcgi/ Does that support websockets? IIS itself seems to ( https://docs.microsoft.c

Re: Django channels on IIS

2019-05-23 Thread Daniel Butler
It looks like I found my key I had to install the application module CGI then use this library to get everything to work! https://pypi.org/project/wfastcgi/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and st

Re: Django channels on IIS

2019-05-23 Thread Daniel Butler
Unfortunately On Thu, May 23, 2019 at 10:09 PM Aldian Fazrihady wrote: > IIS still exists? > > On Fri, 24 May 2019, 09:04 Daniel Butler, wrote: > >> First off I love this project. Django Channels is amazing! >> >> I just wanted to see if anyone has had any success with using iis with >> Django-

Re: Django channels on IIS

2019-05-23 Thread Aldian Fazrihady
IIS still exists? On Fri, 24 May 2019, 09:04 Daniel Butler, wrote: > First off I love this project. Django Channels is amazing! > > I just wanted to see if anyone has had any success with using iis with > Django-Channels since this post over 2 years ago. > > Thank you! > > -- > You received this

Re: Django channels on IIS

2019-05-23 Thread Daniel Butler
First off I love this project. Django Channels is amazing! I just wanted to see if anyone has had any success with using iis with Django-Channels since this post over 2 years ago. Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: django channels help please

2019-02-26 Thread 정정수
The development server does not display an error. This is the same as normal operation. However, the information is not sent to chat_message. # chat/consumers.py from channels.generic.websocket import AsyncWebsocketConsumer import json class ChatConsumer(AsyncWebsocketConsumer): async def co

Re: django channels help please

2019-02-26 Thread Ahmed Ishtiaque
Is any error produced on your development server? Please post the code in your consumers.py file. On Tue, Feb 26, 2019, 8:43 PM 정정수 wrote: > https://channels.readthedocs.io/en/latest/index.html > > Viewed and produced basic tutorials > > I'd like to show you if there's anything special about the

Re: django channels help please

2019-02-26 Thread 정정수
https://channels.readthedocs.io/en/latest/index.html Viewed and produced basic tutorials I'd like to show you if there's anything special about the code It is 100% identical to the tutorial code Chat Rooms What chat room would you like to enter? docum

Re: [Django Channels] Disable default django HTTP routes

2019-02-26 Thread ecastroborsani
I solved it by adding a catch all route with an AsyncHttpConsumer that returns 404 El martes, 26 de febrero de 2019, 20:16:56 (UTC-3), ecastro...@gmail.com escribió: > > [Django Channels] Disable default django HTTP routes > Is there a way to disable django HTTP routes? I've two servers threaded

Re: django channels help please

2019-02-26 Thread egbosi Kelechi
What version of channels are you using? How do you determine the channel _name for each chat rooms? Could you share some code? On Tue, Feb 26, 2019, 11:01 AM 정정수 Hi Dear > ( I use Google Translator ) > I'm Korea devoleper, > please help, > > I am developing two projects. > I saw the tutorial and

Re: django channels help please

2019-02-26 Thread Ahmed Ishtiaque
Could you share your repository? We need more details to determine what’s wrong. On a side note, I made a functional chat app with Django channels here: https://www.github.com/dibs-devs/chatter Good luck! > On Feb 26, 2019, at 4:58 AM, 정정수 wrote: > > Hi Dear > ( I use Google Translator ) >

Re: Django Channels and multi-tenant will this be a world of hurt?

2019-02-24 Thread Ahmed Ishtiaque
@N Muchai, I don't know if you've found a workaround to this, but here's mine if people are interested in the future. I just made a custom ASGI application that adds the tenant schema name (provided your URLs are in the form *.domain.com, where * represents the schema name) and whether the p

Re: Django Channels

2019-01-28 Thread mahesh boini
path('chat//',views.room,name='room') replace this and try i just added "/" On Sun, Jan 27, 2019 at 11:36 PM Vaibhav Kumar Chaudhary < vaibhavkumar...@gmail.com> wrote: > I am trying to create a chat app with Django Channels and facing a bit > problem here. > when I type chat room's name is the

Re: Django Channels and multi-tenant will this be a world of hurt?

2019-01-15 Thread Lorenzo Peña
> > > Hi Filbert, everyone! django-tenant-schemas has a way to infer the tenant from the request, and you could apply the same logic to extend Channel's scope with the tenant. With the tenant on the scope you can incrementally add in-channels multi-tenant logic. Not sure if this helps as you m

Re: Django Channels and multi-tenant will this be a world of hurt?

2019-01-10 Thread N Muchai
@Filbert, Am in the same exact spot using Django Channels with django-tenants. Did you find a way to identify the tenant? Thanks. On Tuesday, November 28, 2017 at 4:22:10 AM UTC+3, Filbert wrote: > > Sorry, yeah dig before I post :-| Can create a class-based consumer and > use the message->he

Re: Django channels communication not asynchronous

2018-12-28 Thread Andrew Godwin
Channels request/response cycles must be natively non-blocking all the way from the application code up through the server. If you even so much as slightly block you're going to disrupt everything and maybe deadlock it, which is why you need to be careful about when you call synchronous things. If

Re: Django channels communication not asynchronous

2018-12-24 Thread Akshay Surya
Sorry for that Actually in my code I did use await before send, but somehow got deleted when I posted here... I would try debugging it but I am having a doubt that it's because django is inherently event driven... Is there something like a request response cycle should be synchronous that y

Re: Django channels communication not asynchronous

2018-12-24 Thread Andrew Godwin
You appear to have missed an "await" before "self.send" - could that be the cause? In general, the best thing to do if things seem to "block" is to set the environment variable PYTHONASYNCIODEBUG=1 and Python will warn you if anything blocks for too long and seems synchronous. Andrew On Mon, Dec

Re: Django channels worker loses some messages

2018-11-11 Thread Andrew Godwin
Are you using Channels 1 or Channels 2? And which channel layer are you using? Andrew On Sun, Nov 11, 2018 at 5:05 AM Parsa Banihashemi < parsa.banihash...@gmail.com> wrote: > Hi, > I have a simple sync consumer which receives websocket messages from the > client, and each time, It passes a mess

Re: Django Channels - core.py error

2018-11-07 Thread Simon Vézina
Hi, I'm coming back with this one as well. I managed to fix my problem. In my consumer, I was making normal Django database queries without the @database_sync_to_async decorator. As soon as I started wrapping my code properly with this decorator, everything started to work fine. See below.

Re: Django Channels - core.py error

2018-11-06 Thread Paul Whipp
I've just had trouble with exactly the same error. In my case I was building from the tutorial ChatConsumer with my own XChatConsumer and I hadn't referenced it in the routing.py. As a result the tutorial async chat consumer was receiving a scope that did not contain a room_name in its url_rout

Re: Django Channels - core.py error

2018-10-11 Thread itsnate_b
Hi Simon, Sorry to hear that you are having the same problem! Channels can be a blessing and a curse. I find it very finicky with very poor documentation & poor error handling. As for the fix: I had an AsyncWebsocketConsumer class in consumers.py within which I had a custom __init__ function. I

Re: Django Channels - core.py error

2018-10-09 Thread Simon Vézina
Hi itsnate_b, Would you mind elaborating on your fix? I'm getting this exact error and I'm at a complete loss. Everything works fine in local, but on my live server, after a couple of minutes/hours of working fine, I start getting this error in the logs. Thanks! Le dimanche 2 septembre 2018

Re: Django Channels - core.py error

2018-09-02 Thread itsnate_b
Turns out there was an erroneous *init* function in the AsyncWebsocketConsumer class. Removing it fixed the issue. On Saturday, September 1, 2018 at 1:23:10 PM UTC-4, itsnate_b wrote: > > I do not think it is even getting to the point where I can accept the > connection from within the consumers

Re: Django Channels - core.py error

2018-09-01 Thread itsnate_b
I do not think it is even getting to the point where I can accept the connection from within the consumers.pyand I'm not sure how to get a better traceback than the one I already provided. On Saturday, September 1, 2018 at 1:20:16 PM UTC-4, itsnate_b wrote: > > > Hi Marius, > Thanks for the

Re: Django Channels - core.py error

2018-09-01 Thread itsnate_b
Hi Marius, Thanks for the recommendation. Yes, I am using channel layers outside of consumers, however, this has not been an issue in the past. I am not clear on what you mean by "virtualenv best practices"? Yes, this is running in a venv, and it has worked in the past. I do think this issue is

Re: Django Channels: long running async function and where to save ORM object

2018-07-18 Thread Andrew Godwin
You can use async inside if you want, it's your choice. You will always have to run the separate process, though, yes. That's just a cleaner way of doing background tasks. Andrew On Mon, Jul 16, 2018 at 11:20 AM Sebastian Haase wrote: > Thanks for the reply. Should I still use async code insi

Re: Django Channels: long running async function and where to save ORM object

2018-07-16 Thread Sebastian Haase
Thanks for the reply. Should I still use async code inside that worker process ? While developing I simply do arun_serveron the command line -- then I would always have to do arun_worker in addition -- right ? -Sebastian On Mon, Jul 16, 2018 at 7:05 PM, Andrew Godwin wrote: >

Re: Django Channels: long running async function and where to save ORM object

2018-07-16 Thread Andrew Godwin
You are correct in that you could store the model instance on "self" but this would result in caching issues, as that instance would not be updated after the initial socket connection. If you want to run "background routines", I would discourage you from doing these as random orphaned tasks launch

Re: [django-channels client wrapper] specifying no reconnection attempts

2018-07-15 Thread Andrew Godwin
I don't know much about that JavaScript code, I'm afraid, otherwise I would try and help (it's likely we're going to deprecate support for it soon as there's no maintainer for it right now anyway). Take a look through the source code and see if there's something you can call to stop reconnection a

Re: Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-23 Thread Andrew Godwin
I'm not sure why that would happen - the code that chooses what application instance to use is here: https://github.com/django/asgiref/blob/master/asgiref/server.py (under get_or_create_application_instance). If you're always using a single channel name, which gets passed as scope_id (see here: ht

Re: Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-22 Thread itsnate_b
I am only using one channel name and my expectation is that only one instance of the background worker class should be initiated/used. Instead, I am seeing a new class being initiated for each call routed to the background worker class. This is unexpected... On Thursday, June 21, 2018 at 3:55:

Re: Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-21 Thread Andrew Godwin
The worker server tries to keep one application instance open per incoming channel name, but that's no guarantee. It will always make a new instance for different channel names. What kind of behaviour are you expecting? Andrew On Tue, Jun 19, 2018 at 6:45 AM itsnate_b wrote: > I am using Django

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-19 Thread itsnate_b
I managed to resolve the cascading crash issue by doing some more asyncio reading and using: self.t1 = asyncio.run_coroutine_threadsafe(self.listen(), loop=loop) instead of: t1 = asyncio.ensure_future(self.listen(), loop=loop) await t1 This makes it run concurrently with the main asyncio channe

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread itsnate_b
I am unable to determine the cause of the handler issue (assuming something is crashing the channels websocket?). Could this be a redis queue issue? Where events being passed through the channel layer are filling up a queue and not being flushed correctly? I have no idea where to go from he

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread itsnate_b
Further to the message above - I moved everything into the consumers.py file and routed to the class inside of there. Still getting this error AFTER I get the print statement print('awaiting t1') I have confirmed that this occurs after this runs successfully: background worker sends a message

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread itsnate_b
Further to the message above - I moved everything into the consumers.py file and routed to the class inside of there. Still getting this error AFTER I get the print statement print('awaiting t1') I have confirmed that this occurs after this runs successfully: background worker sends a message

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread Nathan Bluvol
Hi Andrew, Thank you for your quick reply. I use AsyncConsumer in the background worker because it seems to route properly (i.e. without error). If I create a new class, then I run into scope issues or simply a TypeError where the 'backgroundConsumer object is not callable'. *The reason for all

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-17 Thread Andrew Godwin
I'm not quite sure why you seem to be using an AsyncConsumer outside of the context of the Channels routing framework? Anyway, it sounds like from what you're describing that your listen() method is blocking, which makes sense, as it connects to an external websocket and listens on it for messages

Re: Django channels with python background tasks

2018-05-27 Thread Roger Gammans
Jaiswal, Either my solution 1 or 2 will solve your problem, or rewriting your scripts as management commands (which is probably the easiest route). If you want to keep them separate :- For solution 1; I would look at using the requests library (see https:/ /pypi.org/project/requests/ ) in your back

Re: Django channels with python background tasks

2018-05-27 Thread Umar Kambala
Please when I runserver I gets this error, NameError:name 'template' is not defined. My templates are in this dir mysite/personal/templates/personal. What's my problem? On May 27, 2018 9:04 AM, "Roger Gammans" wrote: > I think there is a little bit of confusion in this thread,a s we keep talk > a

Re: Django channels with python background tasks

2018-05-27 Thread Sourabh Jaiswal
Hi Roger, Thanks for your reply. Yes you are correct. There are actually 2 modules of this project:- 1. Django front end which is totally isolated in itself if I talk about it with back-end reference. And currently it has no mechanism whatsoever to communicate with back-end. 2. python based bac

Re: Django channels with python background tasks

2018-05-27 Thread Roger Gammans
I think there is a little bit of confusion in this thread,a s we keep talk about django and the deamon process and ignoring the frontend. So to clarify; there we are talking about a system with at least 3 execution environments: 1 The Browser2 Django backend processes3 The backend daemon/cli -proce

Re: Django channels with python background tasks

2018-05-27 Thread Sourabh Jaiswal
HI Ryan, The back-end script in this case is not only doing telnet. Its getting data from multiple network elements using telnet and multi-threading. There are multiple threads started when I start the backend script which takes monitoring data from diff-diff network elements at the same time.

Re: Django channels with python background tasks

2018-05-27 Thread Sourabh Jaiswal
Hi Andrew, Thanks a lot for your reply. For a fast and easy approach I need the backend to be able to tell its status when asked by Django and be able to act when django sends some activity events. The back end will be a long running program which will run in an infinite loop once started by d

Re: Django channels with python background tasks

2018-05-26 Thread Ryan Nowakowski
Another idea: create a Django management command that does the telnet stuff and just run that periodically via Cron. You can always move to channels or celery later. On May 26, 2018 9:33:16 AM CDT, Ryan Nowakowski wrote: >In addition to websockets, channels can be used to run background tasks >

Re: Django channels with python background tasks

2018-05-26 Thread Ryan Nowakowski
In addition to websockets, channels can be used to run background tasks that could take a long time for example a telnet connection. You can Google Django channels background tasks. An alternative to channels for background tasks is celery. On May 26, 2018 5:03:51 AM CDT, Andrew Godwin wrote:

Re: Django channels with python background tasks

2018-05-26 Thread Andrew Godwin
Hi Jaiswal, I'm afraid that I can't give detailed help about what your best options are or walk you through how to do it - that's something you'll have to research and decide on yourself. Channels allows you to do low-latency communictation between Django back-ends and JavaScript, but anything you

Re: Django Channels client not consuming

2018-05-15 Thread Andrew Godwin
Hi, I'm afraid you're using incredibly old versions of Channels and the bugs you're encountering are almost certainly fixed in more recent releases. I'm not sure there's much I can do. Andrew On Tue, 15 May 2018, 13:01 LEEPS Lab, wrote: > We have an issue implementing django channels in an oTr

Re: Django-channels request depending Middleware

2018-05-04 Thread Andrew Godwin
That's correct - Django middleware only runs on HTTP request objects, and so doesn't work in a WebSocket context. The recommended alternative is to write ASGI middleware for this purpose. Unfortunately, there is not good documentation on this yet, but you can see a bit about it here, in the authen

Re: Django Channels also works when I have no Worker running.

2018-04-17 Thread Andrew Godwin
Channels 2 does not run requests in workers. Workers are now only for running background tasks on specific channels, and so you do not need them normally. Andrew On Tue, Apr 17, 2018 at 6:54 AM, Christopher Wittlinger < cwittlinge...@gmail.com> wrote: > I think I misunderstood the concept of the

Re: Django Channels also works when I have no Worker running.

2018-04-17 Thread Christopher Wittlinger
I think I misunderstood the concept of the workers. I thought that all Requests (HTTP and Websocket) are delegated to some sort of consumers which is run in a Worker. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gro

Re: Django Channels also works when I have no Worker running.

2018-04-17 Thread Christopher Wittlinger
When I am logging from within the consumers it is logged from my web process and not the worker process. -- 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-

Re: Django channels 2 and data binding

2018-04-17 Thread ijazz jazz
This not only meant that all request data had to be re-serialized over the network, but that you needed to deploy and scale two separate sets of servers. Channels 2 changes this by running the Django code in-process via a threadpool, meaning that the network termination and application logic ar

Re: Django Channels 2 poor performance and high CPU usage

2018-04-04 Thread 'James Foley' via Django users
Not exactly a solution, but after farting about with so many configurations I went back and tried channels 1.1.8. Looks like everything runs perfectly fine on 1.1.8 so I'm not sure what 2.x introduced that is causing me issues. On Wednesday, 28 March 2018 13:08:49 UTC+1, James Foley wrote: > > H

Re: [django-channels] Which process sends message to all channels in a group during group_send?

2018-03-30 Thread kumar deepak
Thanks Andrew. I looked at the code and was able to figure out how it is being done (including the comment to use lua scripts in the future). The deep dive into codebase keeps getting deeper (channels, channels_redis, aioredis, asgiref, twisted, asyncio ...). I am building a chat based game using

Re: [django-channels] Which process sends message to all channels in a group during group_send?

2018-03-30 Thread Andrew Godwin
When you do a group send, the message doing the sending fans out the send to all the target channels (currently using individual commands, and soon with a Lua script inside Redis). We're not using redis pub-sub - we use lists instead. Andrew On Fri, Mar 30, 2018 at 2:26 AM, krdeepak wrote: > Hi

Re: Django Channels 2 poor performance and high CPU usage

2018-03-28 Thread 'James Foley' via Django users
Here is a quick and dirty example which is basically the core of what I'm trying to achieve. https://github.com/jamesfoley/django-channels-test/ Only other requirements other than those in the requirements.txt is redis server. Clone repo, install python 3 requirements using pip, runserver, ope

Re: Django Channels 2 poor performance and high CPU usage

2018-03-28 Thread 'James Foley' via Django users
The project I'm working on is a little sensitive. I'll put together a test project and try and reproduce my issues in the same environment, then push it to a repo for you to take a look at. On Tuesday, 27 March 2018 17:49:19 UTC+1, Andrew Godwin wrote: > > Not getting past HANDSHAKING with the

Re: Django Channels 2 poor performance and high CPU usage

2018-03-27 Thread Andrew Godwin
Not getting past HANDSHAKING with the in-memory layer is a bit weird, and scope is just a normal Python dictionary. Is it possible to put your code up somewhere in a simple form so I can look over it? Andrew On Tue, Mar 27, 2018 at 4:11 AM, 'James Foley' via Django users < django-users@googlegrou

Re: Django Channels 2 poor performance and high CPU usage

2018-03-27 Thread 'James Foley' via Django users
It looks like accessing scope for url kwargs is a big hit on performance. In fact hitting scope for anything seems to introduce some form of delay. I'm getting very mixed results so I'm unsure if this is now an issue with redis. It is definitely the python process using 100% of the CPU though.

Re: Django Channels 2 poor performance and high CPU usage

2018-03-27 Thread 'James Foley' via Django users
Apologies for the double post, I've removed the other one. PYTHONASYNCIODEBUG doesn't appear to give me any warnings. This test I am running is only between two users, each user belonging to the same group. All messages received are pushed back out to all users and filtered clientside. Assumin

Re: Django Channels 2 poor performance and high CPU usage

2018-03-26 Thread Andrew Godwin
(You double-posted this so I'm just going to reply to this one) I need to know a bit more information about what the slowdown is - in particular: * Have you run with PYTHONASYNCIODEBUG=1 set as an environment variable to check for non-yielding coroutines? * What sort of messages per second are we

Re: Django channels 2 and data binding

2018-03-25 Thread Andrew Godwin
You can write most of the data binding functionality yourself in Channels 2 by adding group send methods to model save methods, but if Channels 1 is working for you right now, I wouldn't move until you're forced to. Andrew On Sat, Mar 24, 2018 at 11:07 PM, Fabio Andrés García Sánchez < fabio.garc

Re: Django channels 2 and data binding

2018-03-24 Thread Fabio Andrés García Sánchez
Thank Andrew. I would like to know if it is a good idea to keep using django 1.x to get data binding or would you recomend another path to keep update my frontend with my lastest data? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubsc

Re: Django channels 2 and data binding

2018-03-24 Thread Andrew Godwin
There are no examples yet - I removed data binding from core Channels in the 2.0 release because it had a high maintenance overhead and as yet there's not a replacement. I was hoping someone might volunteer to help build it as an external package but if not, I may eventually get time to write it la

  1   2   3   4   >