Created
September 8, 2015 13:55
-
-
Save pedro-ramirez-suarez/00c1525f5d19bfe565f1 to your computer and use it in GitHub Desktop.
How to connect with DiPS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Abrimos la conexión a Dips | |
client = new DiPS.Client.DiPSClient("ws://localhost:8888/dips"); | |
//Nos subcribimos al evento test | |
client.Subscribe("test", (m) => | |
{ | |
//Imprimimos en la consola la entidad (el objeto m es dynamic) | |
Console.WriteLine("Name: {0}, age:{1}",m.name, n.age); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dipsclient' | |
#Conectando a DiPS | |
client = DiPS::DiPSClient.new "ws://localhost:8888/dips" | |
puts "Conectando" | |
#esperar a que esté lista la conexión | |
sleep 2.0 | |
puts "Subscribiendo a evento test" | |
#Cuando el evento "test" es publicado, se ejecuta este código | |
client.Subscribe ("test") { |payload| puts "Received from DiPS: #{payload}" } | |
#este es la entidad que espera el subscriptor | |
param = {"name"=>"pedro", "age" =>39} | |
puts "Publishing" | |
client.Publish "test", param | |
puts "Enter to exit" | |
k = gets.chomp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment