Comments (2)
It is not possible to use other types of serializer with SwampDragon, as the serializers act in a very particular way (just like DRF serializers won't work with Django's default serializers).
You can however push data to the browser without involving the serializers at all.
If you want to push data to the browser, simply setup a router, subscribe the client (the browser) to a channel, and you can push data.
The chat example does this without involving the models at all.
You have the router: https://github.com/jonashagstedt/swampdragon/blob/master/chat_example/chat_example/chat/routers.py
and the JS controller:
https://github.com/jonashagstedt/swampdragon/blob/master/chat_example/chat_example/static/js/chat-controllers.js
You don't have to use AngularJS if you don't want to, you can easily use vanilla JS (see http://swampdragon.net/documentation/javascript/ for documentation).
Once you have a client subscribed to a channel you don't even need to communicate with the client via the router, you can use the publish_data
function.
In the aforementioned chat example, the client will subscribe to the chat channel.
After that you could, if you wanted to, publish data to that channel as such:
publish_data(channel='chat', data={'foo': 'bar'})
So in this case the serializers aren't used, no model publishing involved etc.
More information on publish_data
http://swampdragon.net/documentation/publishing-data/
from swampdragon.
This is great work. Just to add in the chat_example, mentioned JS controller(chat-controller.js) is not included but app.js.
And i tried with
publish_data(channel='local-channel',kwargs)
it is not working.
And with publish function it is working for all channel names. Can you please explain how to limit messages to specific channels in a same router...
from swampdragon.
Related Issues (20)
- how to implement swampdragon properly
- ERROR:tornado.general:WebSocket ... DoesNotExist: TodoList matching query does not exist.
- Settings.js HOT 3
- Synchronize Swampdragon in django cluster
- [frontend] How to handle arriving messages published to concrete channel HOT 6
- 0.4.2.2 issues w/ tutorial psutil HOT 7
- Todo tutorial - route not found HOT 2
- Idea: add template tag to make template parts update in realtime HOT 7
- has_related_value HOT 1
- Release version does not work with Django1.9 HOT 3
- settings.js not found HOT 2
- unit test does not support for auth
- How to avoid 'false' SwampDragon messages
- takeover
- Site can't be reached!? HOT 6
- Connection Swampdragon to a Redis Socket HOT 1
- About swampdragon.net HOT 1
- swampdragon.net site is down HOT 1
- I will to take this site maintanance and also to update it
- Private chat implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swampdragon.