Results 1 to 3 of 3

Thread: Websocket proxy: push problem

  1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Italy
    Posts
    74
    Answers
    1
    Vote Rating
    11
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    May 2011
    Location
    Italy
    Posts
    74
    Answers
    1
    Vote Rating
    11
      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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •