Can someone help me with #DataSnap REST Application and callbacks?

Can someone help me with #DataSnap   REST Application and callbacks?
I'm new to DataSnap.
I'm going to create simple DS Server and web client with few buttons.
I created new datasnap server (Datasnap REST Application) using wizard, modified web-pages, css, wrote my server methods. it works fine.
Now I need to implement callback method on server, it should send some data to client. I can't understand how I can do that.
I watched "Heavyweight Callbacks with DataSnap
" by Methew DeLong  (Heavyweight Callbacks with DataSnap - Part 2: Thin Client) Seems it is very easy, but it uses "DS Server" wizard and executes callback method using ServerContainer1 variable (ServerContainer1.DSServer1.BroadcastMessage()). But in DS REST Application I have webModule instead of ServerContainer, and do not have references to TWebModule instances.
So, the question is, how do I implement callbacks in DataSnap REST Application at server side (in #Delphi-XE4), or I should use DS Server instead of REST App?
http://www.youtube.com/watch?v=xVUAisxqW0U

Comments

  1. oook, seems I figured it out, I had to check "Server module" option in Server features wizard dialog box

    ReplyDelete
  2. Напиши потом о результатах

    ReplyDelete
  3. Andrey Alisov да там вроде просто все. когда ставишь галку Server Module в проект добавляется DataModule, на котором расположены TDSServer & TDSServerClass (то есть из TWebModule они вырезаются). Вот этот дата модуль с сервером создается единожды при старте. А при вот при каждом создании вэб-модуля, все ссылки на сервер проставляются в OnCreate или конструкторе.
    Соответственно все обратные вызовы реализуются по той же схеме, что и в приведенном выше видео, поскольку экземпляр TDSServer доступен всегда. Правда у меня пока что ничего не работает :)

    ReplyDelete
  4. Andrew Terekhov когда заработает - запости у себя на сайте, плиз. почитаем.

    ReplyDelete
  5. Or here, even.  Google translate is a good thing :)

    ReplyDelete
  6. Lars Fosdal :) did you mean "translate" button under comment?:)

    anyway, I still have no luck with callbacks in REST App :) i've created project as in video above, it works fine. but REST app  uses different components (TIdHTTPWebBrokerBridge instead of TDSHttpService ? ); copied javascipt code to my project, but it doesn't work so far. may be I should recreate my project (:

    ReplyDelete
  7. Yes, I did! Decoding the Cyrillic alphabet is not my strongest side. :)

    ReplyDelete
  8. soo. i've created new Rest app project with test page (with memo as in video). it worked fine, so I copied this page to my existing project and failed.
    In the end I moved old pas files to new project and recreated html pages form scratch.

    ReplyDelete

Post a Comment