dibs-devs / chatter Goto Github PK
View Code? Open in Web Editor NEWA simple Chat App for Django based on channels and websockets
License: MIT License
A simple Chat App for Django based on channels and websockets
License: MIT License
When a user connects to a chatroom, a message can be sent to indicate that they're online. Whenever the websocket is disconnected, a message indicating that can also be sent.
The minute details of that are very similar to #34.
When a user hovers on a message, show the time when it was sent to the chat.
Like other chat applications, use a JS fetch request to get earlier messages from the user and prepend it to the chat section. This would also involve a new view and URL in the urlconf. There will probably be a starting pk for messages to fetched.
Without emoji cannot really express ourself nowadays
To show users that are online/offline .I added it in one of my project so could would like it to be part of in-build project
Hello.
I want chat on the top of my main page. Is it possible ?
If a developer is using the context_processors.py
provided by Chatter, it loads the list of all rooms a logged in user belongs to with every request. This can lead to additional overhead on page load and database querying, which may not be something that all developers want. This would only be relevant if the developer wants chat features on every page.
First stab: make the list of rooms available in the chatroom
and index
views as well as in the context_processor
so that the developer can choose which one to use depending on the implementation they want.
The problem: When chatter is being used by a different app as a reusable package, there needs to be a way for the developer to specify which base template they want chatter templates to inherit from. For example, developers might want a unique HTML header navbar on top of chatter. In this scenario, they will end up needing to copy and paste whole existing chatter templates just to add that navbar which appears all throughout their application.
The solution: Give developers an option to specify a base template chatter can inherit from. This can be specified in their app's settings.py
file as CHATTER_BASE_TEMPLATE
. When this variable is specified, chatter will sit inside the wrapped template provided by the parent application. Otherwise, it will just use the usual base.html
template.
Since on first load, chatter only loads the latest 10 chatrooms, allowing an infinite scroll functionality would be great to have.
This can be done by asking a user to press a button to reconnect to the websocket, and attempting to reconnect upon input.
In chat/models.py
, the Room's id
is defaulted to shortuuid.ShortUUID.random(length=22)
. Should be shortuuid.ShortUUID().random
.
The problem: right now, the chatter homepage shows a generic webpage containing a list of all the rooms and a "Select a room to get started" message. However, to reflect how chat interfaces usually work, chatter should redirect users to the latest chat that's been active.
The solution: When a user hits the index
view, decide if the user has any rooms they belong to. If so, return the chatroom
view with the UUID of the latest room.
When a user receives a message, whatever they were writing in the input field is deleted.
I was really excited to see this package but this didn't worked for me. I followed all the basic steps in read me. And when i hit runserver and moved to http://127.0.0.1:8000/chat . This show me an error :-
`ModuleNotFoundError at /chat/chat/2432b838-e7a2-4913-9c4e-b3bb61023fde/
No module named 'django_chatter.context_processors'
**`ModuleNotFoundError at /chat/chat/2432b838-e7a2-4913-9c4e-b3bb61023fde/
No module named 'django_chatter.context_processors'**
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/chat/chat/2432b838-e7a2-4913-9c4e-b3bb61023fde/
Django Version: 2.2.10
Python Version: 3.7.4
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'messaging',
'rest_framework',
'django_chatter']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "D:\Anaconda\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)
File "D:\Anaconda\lib\site-packages\django\core\handlers\base.py" in _get_response
145. response = self.process_exception_by_middleware(e, request)
File "D:\Anaconda\lib\site-packages\django\core\handlers\base.py" in _get_response
143. response = response.render()
File "D:\Anaconda\lib\site-packages\django\template\response.py" in render
106. self.content = self.rendered_content
File "D:\Anaconda\lib\site-packages\django\template\response.py" in rendered_content
83. content = template.render(context, self._request)
File "D:\Anaconda\lib\site-packages\django\template\backends\django.py" in render
61. return self.template.render(context)
File "D:\Anaconda\lib\site-packages\django\template\base.py" in render
169. with context.bind_template(self):
File "D:\Anaconda\lib\contextlib.py" in __enter__
112. return next(self.gen)
File "D:\Anaconda\lib\site-packages\django\template\context.py" in bind_template
242. processors = (template.engine.template_context_processors +
File "D:\Anaconda\lib\site-packages\django\utils\functional.py" in __get__
80. res = instance.__dict__[self.name] = self.func(instance)
File "D:\Anaconda\lib\site-packages\django\template\engine.py" in template_context_processors
85. return tuple(import_string(path) for path in context_processors)
File "D:\Anaconda\lib\site-packages\django\template\engine.py" in <genexpr>
85. return tuple(import_string(path) for path in context_processors)
File "D:\Anaconda\lib\site-packages\django\utils\module_loading.py" in import_string
17. module = import_module(module_path)
File "D:\Anaconda\lib\importlib\__init__.py" in import_module
127. return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>" in _gcd_import
1006. <source code not available>
File "<frozen importlib._bootstrap>" in _find_and_load
983. <source code not available>
File "<frozen importlib._bootstrap>" in _find_and_load_unlocked
965. <source code not available>
Exception Type: ModuleNotFoundError at /chat/chat/2432b838-e7a2-4913-9c4e-b3bb61023fde/
Exception Value: No module named 'django_chatter.context_processors'`
Please fix it or tell me a temporary solution ASAP.
When it comes to real-time chatting, along comes the idea of real-time notifications as well. On the chatter level, this would involve notifying the app that's using chatter of a new message sent in the system by a user, so that if the parent app wants, it can use the signal to send a notification to the user using the app.
... because c'mon, Flexbox.
Getting this message while installing from pypi
ERROR: Could not find a version that satisfies the requirement channels-redis==2.3.3 (from django-chatter) (from versions: 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.3.2)
When a user starts typing on the chat, show that update to the other user(s) that are online in the chatroom.
This can be done by sending a message down the chatSocket.js object and echoing it out on the other end. Since each message sent through chatSocket object has an associated message_type
string, this can be used to filter what type of message is being sent to the channels consumer for it to process and echo it back into the channel layer.
For now, ChatConsumer
works for databases which don't use multitenancy with django-tenants
and/or django-tenants-schemas
. This needs to be changed to reflect Dibs' implementation of multitenancy, but will most probably be designed to be used with any multitenant apps.
You require explicit versions of channels
and channels-redis
, which are incompatible.
It makes this package kind of not installable.
$ cat requirements.in
django-chatter
$ pip-compile --upgrade --no-index --output-file=requirements.txt requirements.in
Could not find a version that matches asgiref~=2.1,~=2.3,~=3.0 (from channels==2.1.7->django-chatter==1.0.7->-r requirements.in (line 1))
Tried: 0.8, 0.9, 0.9.1, 0.10.0, 0.11.0, 0.11.0, 0.11.0, 0.11.1, 0.11.1, 0.11.2, 0.11.2, 0.12.0, 0.12.0, 0.12.1, 0.12.1, 0.13.0, 0.13.0, 0.13.2, 0.13.2, 0.13.3, 0.14.0, 0.14.0, 1.0.0, 1.0 There are incompatible versions in the resolved dependencies:
asgiref~=2.1 (from channels-redis==2.3.3->django-chatter==1.0.7->-r requirements.in (line 1))
asgiref~=2.3 (from channels==2.1.7->django-chatter==1.0.7->-r requirements.in (line 1))
asgiref~=3.0 (from daphne==2.3.0->channels==2.1.7->django-chatter==1.0.7->-r requirements.in (line 1))
We can send messages but still cannot send images or other documents to the chat
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.