-
18 Apr 2013 2:16 PM #1
Ext.ux.data.proxy.WebSocket is among us!
Ext.ux.data.proxy.WebSocket is among us!
Hi ExtJSers!
Finally, I made it!
After two evenings of hard work, I'm proud to present you Ext.ux.data.proxy.WebSocket: http://wilk.github.io/Ext.ux.data.proxy.WebSocket/
Yeah, great, fantastic but.... what is that??
Did you remember Ext.ux.WebSocket? (http://wilk.github.io/ExtJS-WebSocket/)
Well, I made an extension to integrate easily HTML5 WebSockets with ExtJS grids and charts and every component that uses Ext.data.Store!!
It automagically communicates with the server, using CRUD operation through the sync/load store actions.
Here's a brief example:
See other examples on the github page, clone the repo and try out the demo (I suggest you to open two browsers and see the magic in action!), star and fork the project, and if you like it, make the documentation with jsduckCode:var store = Ext.create ('Ext.data.Store', { fields: ['id', 'name', 'age'] , storeId: 'myStore', proxy: { type: 'websocket', url: 'ws://localhost:8888', reader: { type: 'json', root: 'user' } } }); var grid = Ext.create ('Ext.grid.Panel', { title: 'My Grid', width: 500, height: 300, store: store, columns: [{ dataIndex: 'name', text: 'Name' }, { dataIndex: 'age', text: 'Age' }] }); store.load(); // a read operation is sent to the server ... store.sync ({ // commit updates by sending 'create' or 'update' or 'destroy' operation to the server success: function () { store.load (); // and then refresh the grid } });
Sencha Market: https://market.sencha.com/extensions...roxy-websocket
Cheers!!
Wilk
-
19 Apr 2013 2:54 AM #2
This is marvelous!
Will it work with websocket backends like socket.io?
Does this mean, the store will continually update its data as messages arrive over websocket?
Very cool indeed.
Question. How does this compare to Ext Direct?
-
19 Apr 2013 3:13 AM #3
Thank you so much! Congratulations, questions and constructive criticism are welcome

Well, it doesn't work with socket.io because it's a particular backend.
However, it works great with other backends, like Tornado (Python): https://github.com/wilk/Ext.ux.data.proxy.WebSocket/blob/master/demo/server.py
Yes, the store is continually update by the proxy by intercepting new data incoming from server (push technology).
Honestly, I didn't think to Ext.Direct, so I don't know if you can integrate with it.
I'll give it a look!
Ciao!
Wilk
-
20 Apr 2013 11:20 PM #4
Thanks for sharing!
-
21 Apr 2013 7:25 AM #5
-
23 Apr 2013 1:52 AM #6
Nice. Tx for the work!
A Socket.IO version would be awesome.
-
23 Apr 2013 1:56 AM #7
-
23 Apr 2013 1:59 AM #8
That would be great!!
I don't like the gridplugins method.
Implement it in the store is the best thing to do.
I'm thinking about making a Ext.Direct Socket.IO implementation myself, or are there any implementations already?
-
23 Apr 2013 2:12 AM #9
I don't know if exists an implementation of Ext.Direct + Socket.io.
However, there's extjs-socketio: https://github.com/softwarezman/extjs-socketio
I think I will give it a look to make ExtJS-WebSocket working with socketio
Cheers!
Wilk
-
24 Apr 2013 1:26 AM #10
Hi @wilky, thanks for your great contribution!
I have a question regarding the server side when I am trying to play with your WebSocket ux. I saw a server.py from the source repository. As I don't have much knowledge about python, I'm planning to write my server program using Java. I tried to understand the server.py, and here's my understanding, would you please confirm or correct me:
1, What the server.py does is to echo whatever it received to all connected/registered clients?
2, server.py does not contain any special logic that could be a dependency for the clients?
I think if the answer to the first question would be yes, then automatically the answer to the second question would be yes.
Would you please help to confirm or correct me? Thanks.


Reply With Quote

