I'm getting started with the Server to Server API. I see the serverIntegration/ruby/README.txt file and both Rails example projects at sampleApps/ExternalAuthentication/rails and sampleApps/Server2Server/DevConsole_RubyOnRails; however, these two examples don't implement what the readme describes. Could you provide or direct me to a Ruby on Rails example of the Server to Server API that implements what the readme describes?
Solved! Go to Solution.
Views
Replies
Total Likes
I downloaded the current SDK and checked that the file rtchooks_controller.rb is in there. Could it be that you moved it into your app or something ?
Regarding the file rubyamf_config.rb, I think it's generated when you install the rubyamf plugin, as specified in the instructions. We don't ship the plugin embedded in the app because of copyright/licensing issues. Even if the plugin is open-source and with a very liberal license we need to submit all the code we ship to our legal department and they need to approve it, so the less external packages we ship, the easier our life is
Regarding the version of rtchooks_controller in the sample applications, yes, that version is specific for the application. The file that you are missing is basically a "template" with all the methods you need to implements.
This, for example, is the template for receiveItem:
# Called any time publishItem is triggered on a collectionNode
# which has been subscribed to.
# Note that ALL MESSAGES, whether private or not,
# are sent to server listeners.
# messageItemVO is a simple (POJO-like) representation of a messageItem,
# which can be deserialized via MessageItem.readValueObject();
def receiveItem
token = params[:token]
roomName= params[:roomName]
collectionName= params[:collectionName]
item= params[:item]
respond_to do |format|
format.amf { render :amf => true }
end
end
Basically you would get the parameters, check that the message is for the room and collection you want to monitor and parse the item.
Views
Replies
Total Likes
What feature are you trying to implement ?
The README.txt describes how to write an http application that subscribes and gets notification when items are published/removed. The associated file is serverIntegration/ruby/rtchooks_controller.rb that should be added to a Rails application, together with RubyAMF as described in the README file (sorry for the very generic filename and don't ask me why is not called, for example, README_RTCHOOKS.txt )
The DevConsole_RubyOnRails example does implement what is described in the README. You can see that it includes the rtchooks_controller and stuff.
If you are looking for an example that shows more "real time" messaging between a room and your server you may want to look at some of the other Server2Server example, or write a simple Rails application that "subscribe" to a node and prints out items while they arrive
Views
Replies
Total Likes
Thanks Raff. The feature I'm trying to implement notifies me when a user enters or leaves a room.
The serverIntegration/ruby/rtchooks_controller.rb file does not exist for me. The only things in serverIntegration/ruby are doc and README.txt. Is there another version of the SDK I should have? I updated about a week and a half ago.
Also, in the DevConsole project, the rtchooks_controller has a lot of code specific to that app? Is there any boilerplate code that is supposed to be in that file?
Views
Replies
Total Likes
Additionally, I don't see either the DevConsole or the Server2Server example using the file mentioned in step 2 of the README.txt: rubyamf_config.rb
Views
Replies
Total Likes
I downloaded the current SDK and checked that the file rtchooks_controller.rb is in there. Could it be that you moved it into your app or something ?
Regarding the file rubyamf_config.rb, I think it's generated when you install the rubyamf plugin, as specified in the instructions. We don't ship the plugin embedded in the app because of copyright/licensing issues. Even if the plugin is open-source and with a very liberal license we need to submit all the code we ship to our legal department and they need to approve it, so the less external packages we ship, the easier our life is
Regarding the version of rtchooks_controller in the sample applications, yes, that version is specific for the application. The file that you are missing is basically a "template" with all the methods you need to implements.
This, for example, is the template for receiveItem:
# Called any time publishItem is triggered on a collectionNode
# which has been subscribed to.
# Note that ALL MESSAGES, whether private or not,
# are sent to server listeners.
# messageItemVO is a simple (POJO-like) representation of a messageItem,
# which can be deserialized via MessageItem.readValueObject();
def receiveItem
token = params[:token]
roomName= params[:roomName]
collectionName= params[:collectionName]
item= params[:item]
respond_to do |format|
format.amf { render :amf => true }
end
end
Basically you would get the parameters, check that the message is for the room and collection you want to monitor and parse the item.
Views
Replies
Total Likes
Thanks. I think I've got it now with that.
I downloaded the SDK directly, and it's there; however, it is not available from where the SDK Navigator downloaded the SDK. I've done this on my main computer and on a VM. I don't think it's likely that I moved the file on both locations, but I guess it's possible. Anyway, I have it now.
Views
Replies
Total Likes
Views
Likes
Replies