1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Italy
    Posts
    72
    Vote Rating
    7
    Answers
    1
    Wilky is on a distinguished road

      0  

    Default Answered: Websocket proxy: push problem

    Answered: Websocket proxy: push problem


    Hi guys,

    I'm developing a websocket proxy (https://github.com/wilk/Ext.ux.data.proxy.WebSocket), based on Ext.ux.WebSocket (http://wilk.github.com/ExtJS-WebSocket/).
    The proxy works well except when is the server to start the update.
    Take the following example:

    I've a grid and a store attached: this store has a websocket proxy.
    At the beginning, the proxy is created but no CRUD operation is done, neither read operations.
    At a certain point, the server pushes some data to every listening websockets and the websocket proxy should update his store: here's the problem!
    How can the proxy update his store?

    The proxy model is based on the following pattern (if I'm not wrong):
    the store makes an operation and tells to his proxy to do it, appending a callback function;
    the proxy takes the operation and goes ahead;
    when the operation is finished, the proxy calls the store callback function (actually, this is the glue between stores and proxys).

    Now, I've no one point of communication between store and proxy until the store makes an operation (a read, for example).
    So, before this situation, how can the proxy update his store?

    I hope that everything is clear

    Ciao!
    Wilk

  2. The issue here is the proxy doesn't really know it belongs to a store (it could belong to a Model even).

    You could create a store extension to either set a reference of the store on the proxy or use events on the proxy to then get in to the onProxyLoad passing an Operation instance you create in the proxy.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      1  

    Default


    The issue here is the proxy doesn't really know it belongs to a store (it could belong to a Model even).

    You could create a store extension to either set a reference of the store on the proxy or use events on the proxy to then get in to the onProxyLoad passing an Operation instance you create in the proxy.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    May 2011
    Location
    Italy
    Posts
    72
    Vote Rating
    7
    Answers
    1
    Wilky is on a distinguished road

      0  

    Default


    Damn, that what I was afraid of!
    So, I've to create two extensions: one for the proxy and the other for the store, right?

    Thanks anyway!

Thread Participants: 1

Tags for this Thread