SlideShare a Scribd company logo
Comunicandonuestras appscon el mundo exterior 
Roberto Luis Bisbé 
rlbisbe.net 
@rlbisbe
@rlbisbe 
•Ingeniero en Informática @ UAM 
•Desarrollador @ frontiers 
•WP, W8 & Android dev 
•rlbisbe.net
Corría el año2006…
Corría el año2006…
Penetrómetro
Penetrómetro
.NET Compact 
Framework 
.NET 
Framework 
USB 
RemoteAPI
Comunicarnuestras appscon el mundo exterior
Imagen: https://flic.kr/p/aKN6u6 
Examinandola superficie
RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
API REST!
Web Sockets
! Web Socket 
•SignalR 
•.NET 
•socket.io 
•node.js 
•Python 
•faye 
•ruby
Qué es WebSocket 
•Bidireccional 
•HTTP 
•Soporte nativo en 8.x
Servidor 
varserver = http.createServer(app) 
server.listen(1430) 
varwss= new WebSocketServer({ server: server }); 
wss.on("connection", function(ws) { 
ws.on("message", function(data) { 
ws.send("response"); 
}) 
ws.on("close", function() { 
//Closed 
}) 
}
Servidor 
varserver = http.createServer(app) 
server.listen(1430) 
varwss= new WebSocketServer({ server: server }); 
wss.on("connection", function(ws) { 
ws.on("message", function(data) { 
ws.send("response"); 
}) 
ws.on("close", function() { 
//Closed 
}) 
}
Servidor 
varserver = http.createServer(app) 
server.listen(1430) 
varwss= new WebSocketServer({ server: server }); 
wss.on("connection", function(ws) { 
ws.on("message", function(data) { 
ws.send("response"); 
}) 
ws.on("close", function() { 
//Closed 
}) 
}
Cliente -Conexión 
varwebSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Conexión 
ver webSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Conexión 
ver webSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Conexión 
ver webSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Envío y recepción 
var_messageWriter= new DataWriter(webSocket.OutputStream); 
_messageWriter.WriteString(message); 
await_messageWriter.StoreAsync(); 
varstream = new 
StreamReader(args.GetDataStream().AsStreamForRead()); 
stringmessage= stream.ReadToEnd();
Cliente -Envío y recepción 
var_messageWriter= new DataWriter(webSocket.OutputStream); 
_messageWriter.WriteString(message); 
await_messageWriter.StoreAsync(); 
varstream = new 
StreamReader(args.GetDataStream().AsStreamForRead()); 
stringmessage= stream.ReadToEnd();
Ejemplo completo 
DEMO 
C# 
Node JS 
WebSocket
WebSocket 
•Bidireccional 
•HTTP 
•Soporte nativo en 8.x
Bajando de nivel 
Imagen: https://flic.kr/p/aKN6u6
StreamSockets 
•Flujo de datos sobre TCP 
•Texto, imágenes, audio, vídeo… 
•Permisos
Servidor -Conexión 
varlistenSocket= new StreamSocketListener(); 
listenSocket.ConnectionReceived+= ConnectionReceived; 
awaitlistenSocket.BindServiceNameAsync("5000");
Servidor -Recepción 
DataReaderreader= new DataReader(connectionSocket.InputStream); 
uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); 
if(sizeFieldCount!= sizeof(long)) return; 
uintresultLength= (uint)reader.ReadInt32(); 
uintactualResultLength= awaitreader.LoadAsync(resultLength); 
if(resultLength!= actualResultLength) return; 
varbyteResult= new byte[resultLength]; 
reader.ReadBytes(byteResult);
Servidor -Recepción 
DataReaderreader= new DataReader(connectionSocket.InputStream); 
uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); 
if(sizeFieldCount!= sizeof(long)) return; 
uintresultLength= (uint)reader.ReadInt32(); 
uintactualResultLength= awaitreader.LoadAsync(resultLength); 
if(resultLength!= actualResultLength) return; 
varbyteResult= new byte[resultLength]; 
reader.ReadBytes(byteResult);
Servidor -Recepción 
uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); 
if(sizeFieldCount!= sizeof(long)) return; 
uintresultLength= (uint)reader.ReadInt32(); 
uintactualResultLength= awaitreader.LoadAsync(resultLength); 
if(resultLength!= actualResultLength) return; 
varbyteResult= new byte[resultLength]; 
reader.ReadBytes(byteResult);
Cliente -Conexión 
varconnectionSocket= new StreamSocket(); 
varserverHost= new HostName(server); 
awaitconnectionSocket.ConnectAsync(serverHost, port);
Cliente -Envío 
varwriter= new DataWriter(connectionSocket.OutputStream); 
writer.WriteInt32(bytes.Length); 
writer.WriteBytes(bytes); 
awaitwriter.StoreAsync(); 
writer.DetachStream();
Cliente -Envío 
varwriter= new DataWriter(connectionSocket.OutputStream); 
writer.WriteInt32(bytes.Length); 
writer.WriteBytes(bytes); 
awaitwriter.StoreAsync(); 
writer.DetachStream();
Cliente -Envío 
varwriter= new DataWriter(connectionSocket.OutputStream); 
writer.WriteInt32(bytes.Length); 
writer.WriteBytes(bytes); 
awaitwriter.StoreAsync(); 
writer.DetachStream();
Ejemplo completo 
DEMO 
WinRTC# 
WinRTC# 
Socket
StreamSockets 
•Flujo de datos sobre TCP 
•Texto, imágenes, audio, vídeo… 
•Requiere permisos
En las profundidades 
Imagen: https://flic.kr/p/48XdaQ
PebbleSmartwatch 
•iOS & Android 
•APIs 
•SDK 
•Bluetooth!
Las cosas no siempre salen como esperamos 
Imagen: https://flic.kr/p/8bDAS1
Volvamos a la RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
Volvamos a la RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
Volvamos a la RaspberryPI 
•ARM 
•Linux 
•USB + Bluetooth 
•Ethernet 
•Sensores
Bluetooth IS EVIL 
•P2P 
•Alcance 
•Consumo 
•Servicios 
•Ancho de banda 
•Pairing, Búsqueda, Conexión
Servidor 
server_sock=BluetoothSocket( RFCOMM ) 
server_sock.bind(("",22)) 
server_sock.listen(22) 
client_sock, client_info= server_sock.accept() 
whileTrue: 
data = client_sock.recv(1024) 
client_sock.close() 
server_sock.close()
Servidor 
server_sock=BluetoothSocket( RFCOMM ) 
server_sock.bind(("",22)) 
server_sock.listen(22) 
client_sock, client_info= server_sock.accept() 
whileTrue: 
data = client_sock.recv(1024) 
client_sock.close() 
server_sock.close()
Servidor 
server_sock=BluetoothSocket( RFCOMM ) 
server_sock.bind(("",22)) 
server_sock.listen(22) 
client_sock, client_info= server_sock.accept() 
whileTrue: 
data = client_sock.recv(1024) 
client_sock.close() 
server_sock.close()
Cliente -Búsqueda 
chatServiceInfoCollection= 
awaitDeviceInformation.FindAllAsync( 
RfcommDeviceService.GetDeviceSelector( 
RfcommServiceId.SerialPort));
Cliente –Conexión 
varchatServiceInfo= chatServiceInfoCollection[0]; 
varservice= 
awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); 
awaitchatSocket.ConnectAsync( 
service.ConnectionHostName, 
service.ConnectionServiceName); 
varchatWriter= new DataWriter(chatSocket.OutputStream); 
varchatReader= new DataReader(chatSocket.InputStream);
Cliente –Conexión 
varchatServiceInfo= chatServiceInfoCollection[0]; 
varservice= 
awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); 
awaitchatSocket.ConnectAsync( 
service.ConnectionHostName, 
service.ConnectionServiceName); 
varchatWriter= new DataWriter(chatSocket.OutputStream); 
varchatReader= new DataReader(chatSocket.InputStream);
Cliente –Conexión 
varchatServiceInfo= chatServiceInfoCollection[0]; 
varservice= 
awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); 
awaitchatSocket.ConnectAsync( 
service.ConnectionHostName, 
service.ConnectionServiceName); 
varchatWriter= new DataWriter(chatSocket.OutputStream); 
varchatReader= new DataReader(chatSocket.InputStream);
Cliente –Envío y recepción 
chatWriter.WriteString("open"); 
awaitchatWriter.StoreAsync(); 
byte[] buffer = new byte[10]; 
awaitchatSocket.InputStream.ReadAsync( 
buffer.AsBuffer(), 10, 
InputStreamOptions.Partial); 
stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
Cliente –Envío y recepción 
chatWriter.WriteString("open"); 
awaitchatWriter.StoreAsync(); 
byte[] buffer = new byte[10]; 
awaitchatSocket.InputStream.ReadAsync( 
buffer.AsBuffer(), 10, 
InputStreamOptions.Partial); 
stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
Ejemplo completo 
DEMO 
C# 
Python 
Bluetooth Serial Port
Bluetooth IS STILL EVIL 
•P2P 
•Alcance 
•Consumo 
•Servicios 
•Ancho de banda 
•Pairing, Búsqueda, Conexión
Podemos comunicarnuestras apps con el mundo exterior
WebSockets, sockets, bluetooth, GPS, infrarrojos, sonido, NFC, sensores
Preguntas? Hay regalitos…
Gracias! Enlaces, código y slidesen rlbisbe.net 
roberto.luis@rlbisbe.net 
@rlbisbe

More Related Content

What's hot

Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
PHP Indonesia
 
Build App with Nodejs - YWC Workshop
Build App with Nodejs - YWC WorkshopBuild App with Nodejs - YWC Workshop
Build App with Nodejs - YWC Workshop
Sarunyhot Suwannachoti
 
WebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction PresentationWebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction Presentation
Brad Beiermann
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
Chen-Tien Tsai
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
 
Javascript Myths and its Evolution
Javascript Myths and its  EvolutionJavascript Myths and its  Evolution
Javascript Myths and its Evolution
Deepu S Nath
 
Evolution of java script libraries
Evolution of java script librariesEvolution of java script libraries
Evolution of java script libraries
Columbia Developers Guild
 
JS digest, March 2017
JS digest, March 2017JS digest, March 2017
JS digest, March 2017
ElifTech
 
Open Source Flash 2010
Open Source Flash 2010Open Source Flash 2010
Open Source Flash 2010
Gaurav Saxena
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
CodeValue
 
Managing Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEXManaging Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEX
Kai Donato
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
FITC
 
Node.js for beginner
Node.js for beginnerNode.js for beginner
Node.js for beginner
Sarunyhot Suwannachoti
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
Kasey McCurdy
 
JS digest. May 2017
JS digest. May 2017JS digest. May 2017
JS digest. May 2017
ElifTech
 
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebGeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
Bhagaban Behera
 
Tech talk: PHP
Tech talk: PHPTech talk: PHP
Tech talk: PHP
Jen Wei Lee
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
CloudFoundry@home
CloudFoundry@homeCloudFoundry@home
CloudFoundry@home
Yohei Sasaki
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
Dotitude
 

What's hot (20)

Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
 
Build App with Nodejs - YWC Workshop
Build App with Nodejs - YWC WorkshopBuild App with Nodejs - YWC Workshop
Build App with Nodejs - YWC Workshop
 
WebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction PresentationWebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction Presentation
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
Javascript Myths and its Evolution
Javascript Myths and its  EvolutionJavascript Myths and its  Evolution
Javascript Myths and its Evolution
 
Evolution of java script libraries
Evolution of java script librariesEvolution of java script libraries
Evolution of java script libraries
 
JS digest, March 2017
JS digest, March 2017JS digest, March 2017
JS digest, March 2017
 
Open Source Flash 2010
Open Source Flash 2010Open Source Flash 2010
Open Source Flash 2010
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
 
Managing Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEXManaging Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEX
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
 
Node.js for beginner
Node.js for beginnerNode.js for beginner
Node.js for beginner
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
JS digest. May 2017
JS digest. May 2017JS digest. May 2017
JS digest. May 2017
 
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebGeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
 
Tech talk: PHP
Tech talk: PHPTech talk: PHP
Tech talk: PHP
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
CloudFoundry@home
CloudFoundry@homeCloudFoundry@home
CloudFoundry@home
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 

Viewers also liked

Windows 8 Universidad de Valencia
Windows 8 Universidad de ValenciaWindows 8 Universidad de Valencia
Windows 8 Universidad de Valencia
Roberto Luis Bisbé
 
Lecciones aprendidas creando una red social
Lecciones aprendidas creando una red socialLecciones aprendidas creando una red social
Lecciones aprendidas creando una red social
Roberto Luis Bisbé
 
Tres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carreraTres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carrera
Roberto Luis Bisbé
 
Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Roberto Luis Bisbé
 
Windows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NETWindows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NET
Roberto Luis Bisbé
 
Windows phonesessions
Windows phonesessionsWindows phonesessions
Windows phonesessions
Roberto Luis Bisbé
 
Una visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v nextUna visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v next
Eduard Tomàs
 
De escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincherasDe escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincheras
Roberto Luis Bisbé
 
Javascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OSJavascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OS
Roberto Luis Bisbé
 
DotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su APIDotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su API
Roberto Luis Bisbé
 
Desarrollo Full Stack UAM.net
Desarrollo Full Stack UAM.netDesarrollo Full Stack UAM.net
Desarrollo Full Stack UAM.net
Roberto Luis Bisbé
 
APIs REST
APIs RESTAPIs REST
Los lenguajes de la web
Los lenguajes de la webLos lenguajes de la web
Los lenguajes de la web
Roberto Luis Bisbé
 

Viewers also liked (13)

Windows 8 Universidad de Valencia
Windows 8 Universidad de ValenciaWindows 8 Universidad de Valencia
Windows 8 Universidad de Valencia
 
Lecciones aprendidas creando una red social
Lecciones aprendidas creando una red socialLecciones aprendidas creando una red social
Lecciones aprendidas creando una red social
 
Tres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carreraTres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carrera
 
Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8
 
Windows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NETWindows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NET
 
Windows phonesessions
Windows phonesessionsWindows phonesessions
Windows phonesessions
 
Una visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v nextUna visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v next
 
De escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincherasDe escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincheras
 
Javascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OSJavascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OS
 
DotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su APIDotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su API
 
Desarrollo Full Stack UAM.net
Desarrollo Full Stack UAM.netDesarrollo Full Stack UAM.net
Desarrollo Full Stack UAM.net
 
APIs REST
APIs RESTAPIs REST
APIs REST
 
Los lenguajes de la web
Los lenguajes de la webLos lenguajes de la web
Los lenguajes de la web
 

Similar to Comunicando nuestras apps con el mundo exterior

signalr
signalrsignalr
signalr
Owen Chen
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
Shubhra Kar
 
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
Alexandre Brandão Lustosa
 
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitMatrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Alan Quayle
 
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent ConnectionsBuilding an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Renaun Erickson
 
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
SenZations Summer School
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
WebSocket
WebSocketWebSocket
WebSocket
njamnjam
 
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationWebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
Amir Zmora
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
Sepehr Rasouli
 
MUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration AnalystMUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration Analyst
Fajar Nugroho
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
Mohammad Qureshi
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
David Lindkvist
 
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
mfrancis
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Adam Dunkels
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
Gonzalo Ayuso
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJS
Israel Gutiérrez
 
111214 node conf
111214 node conf111214 node conf
111214 node conf
Kensaku Komatsu
 
Apache Libcloud
Apache LibcloudApache Libcloud
Apache Libcloud
Sebastien Goasguen
 
Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOps
YongHyuk Lee
 

Similar to Comunicando nuestras apps con el mundo exterior (20)

signalr
signalrsignalr
signalr
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
 
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitMatrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
 
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent ConnectionsBuilding an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent Connections
 
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
WebSocket
WebSocketWebSocket
WebSocket
 
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationWebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
MUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration AnalystMUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration Analyst
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJS
 
111214 node conf
111214 node conf111214 node conf
111214 node conf
 
Apache Libcloud
Apache LibcloudApache Libcloud
Apache Libcloud
 
Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOps
 

More from Roberto Luis Bisbé

Scala desde c# y JavaScript
Scala desde c# y JavaScriptScala desde c# y JavaScript
Scala desde c# y JavaScript
Roberto Luis Bisbé
 
Desarrollo de aplicaciones para Windows 8 y Windows Phone
Desarrollo de aplicaciones para Windows 8 y Windows PhoneDesarrollo de aplicaciones para Windows 8 y Windows Phone
Desarrollo de aplicaciones para Windows 8 y Windows Phone
Roberto Luis Bisbé
 
Desarrollo Metro con Windows 8 UPM
Desarrollo Metro con Windows 8 UPMDesarrollo Metro con Windows 8 UPM
Desarrollo Metro con Windows 8 UPM
Roberto Luis Bisbé
 
Aplicaciones Metro para Windows 8
Aplicaciones Metro para Windows 8Aplicaciones Metro para Windows 8
Aplicaciones Metro para Windows 8
Roberto Luis Bisbé
 
Hardcore PHP
Hardcore PHPHardcore PHP
Hardcore PHP
Roberto Luis Bisbé
 
El patrón MVC
El patrón MVCEl patrón MVC
El patrón MVC
Roberto Luis Bisbé
 
Social Media
Social MediaSocial Media
Social Media
Roberto Luis Bisbé
 
Fundamentos de sitios web accesibles
Fundamentos de sitios web accesiblesFundamentos de sitios web accesibles
Fundamentos de sitios web accesibles
Roberto Luis Bisbé
 

More from Roberto Luis Bisbé (8)

Scala desde c# y JavaScript
Scala desde c# y JavaScriptScala desde c# y JavaScript
Scala desde c# y JavaScript
 
Desarrollo de aplicaciones para Windows 8 y Windows Phone
Desarrollo de aplicaciones para Windows 8 y Windows PhoneDesarrollo de aplicaciones para Windows 8 y Windows Phone
Desarrollo de aplicaciones para Windows 8 y Windows Phone
 
Desarrollo Metro con Windows 8 UPM
Desarrollo Metro con Windows 8 UPMDesarrollo Metro con Windows 8 UPM
Desarrollo Metro con Windows 8 UPM
 
Aplicaciones Metro para Windows 8
Aplicaciones Metro para Windows 8Aplicaciones Metro para Windows 8
Aplicaciones Metro para Windows 8
 
Hardcore PHP
Hardcore PHPHardcore PHP
Hardcore PHP
 
El patrón MVC
El patrón MVCEl patrón MVC
El patrón MVC
 
Social Media
Social MediaSocial Media
Social Media
 
Fundamentos de sitios web accesibles
Fundamentos de sitios web accesiblesFundamentos de sitios web accesibles
Fundamentos de sitios web accesibles
 

Recently uploaded

當測試開始左移
當測試開始左移當測試開始左移
當測試開始左移
Jersey (CHE-PING) Su
 
GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
attueb
 
To Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance SheetsTo Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance Sheets
Task Tracker
 
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction InnovationNYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS Construction ERP Software
 
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Deliverybangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
sunilverma7884
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
87tomato
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
ThousandEyes
 
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
bhumivarma35300
 
Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech
 
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
Srinivas Dukka
 
ERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in CoimbatoreERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in Coimbatore
Nextskill Technologies
 
Comprehensive Vulnerability Assessments Process _ Aardwolf Security.docx
Comprehensive Vulnerability Assessments Process _ Aardwolf Security.docxComprehensive Vulnerability Assessments Process _ Aardwolf Security.docx
Comprehensive Vulnerability Assessments Process _ Aardwolf Security.docx
Aardwolf Security
 
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
jealousviolet
 
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
rachitkumar09887
 
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
3610stuck
 
Blockchain in Agricultural Traceability Use Cases in 2024.pdf
Blockchain in Agricultural Traceability Use Cases in 2024.pdfBlockchain in Agricultural Traceability Use Cases in 2024.pdf
Blockchain in Agricultural Traceability Use Cases in 2024.pdf
Natsoft Corporation
 
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
902basic
 
Attendance Tracking From Paper To Digital
Attendance Tracking From Paper To DigitalAttendance Tracking From Paper To Digital
Attendance Tracking From Paper To Digital
Task Tracker
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
shivamt017
 
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
ashiklo9823
 

Recently uploaded (20)

當測試開始左移
當測試開始左移當測試開始左移
當測試開始左移
 
GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
 
To Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance SheetsTo Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance Sheets
 
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction InnovationNYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction Innovation
 
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Deliverybangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
 
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
 
Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.
 
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
 
ERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in CoimbatoreERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in Coimbatore
 
Comprehensive Vulnerability Assessments Process _ Aardwolf Security.docx
Comprehensive Vulnerability Assessments Process _ Aardwolf Security.docxComprehensive Vulnerability Assessments Process _ Aardwolf Security.docx
Comprehensive Vulnerability Assessments Process _ Aardwolf Security.docx
 
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
 
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
 
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
 
Blockchain in Agricultural Traceability Use Cases in 2024.pdf
Blockchain in Agricultural Traceability Use Cases in 2024.pdfBlockchain in Agricultural Traceability Use Cases in 2024.pdf
Blockchain in Agricultural Traceability Use Cases in 2024.pdf
 
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
 
Attendance Tracking From Paper To Digital
Attendance Tracking From Paper To DigitalAttendance Tracking From Paper To Digital
Attendance Tracking From Paper To Digital
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
 
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
 

Comunicando nuestras apps con el mundo exterior

  • 1. Comunicandonuestras appscon el mundo exterior Roberto Luis Bisbé rlbisbe.net @rlbisbe
  • 2. @rlbisbe •Ingeniero en Informática @ UAM •Desarrollador @ frontiers •WP, W8 & Android dev •rlbisbe.net
  • 7. .NET Compact Framework .NET Framework USB RemoteAPI
  • 10. RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 11. RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 14. ! Web Socket •SignalR •.NET •socket.io •node.js •Python •faye •ruby
  • 15. Qué es WebSocket •Bidireccional •HTTP •Soporte nativo en 8.x
  • 16. Servidor varserver = http.createServer(app) server.listen(1430) varwss= new WebSocketServer({ server: server }); wss.on("connection", function(ws) { ws.on("message", function(data) { ws.send("response"); }) ws.on("close", function() { //Closed }) }
  • 17. Servidor varserver = http.createServer(app) server.listen(1430) varwss= new WebSocketServer({ server: server }); wss.on("connection", function(ws) { ws.on("message", function(data) { ws.send("response"); }) ws.on("close", function() { //Closed }) }
  • 18. Servidor varserver = http.createServer(app) server.listen(1430) varwss= new WebSocketServer({ server: server }); wss.on("connection", function(ws) { ws.on("message", function(data) { ws.send("response"); }) ws.on("close", function() { //Closed }) }
  • 19. Cliente -Conexión varwebSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 20. Cliente -Conexión ver webSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 21. Cliente -Conexión ver webSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 22. Cliente -Conexión ver webSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 23. Cliente -Envío y recepción var_messageWriter= new DataWriter(webSocket.OutputStream); _messageWriter.WriteString(message); await_messageWriter.StoreAsync(); varstream = new StreamReader(args.GetDataStream().AsStreamForRead()); stringmessage= stream.ReadToEnd();
  • 24. Cliente -Envío y recepción var_messageWriter= new DataWriter(webSocket.OutputStream); _messageWriter.WriteString(message); await_messageWriter.StoreAsync(); varstream = new StreamReader(args.GetDataStream().AsStreamForRead()); stringmessage= stream.ReadToEnd();
  • 25. Ejemplo completo DEMO C# Node JS WebSocket
  • 26. WebSocket •Bidireccional •HTTP •Soporte nativo en 8.x
  • 27. Bajando de nivel Imagen: https://flic.kr/p/aKN6u6
  • 28. StreamSockets •Flujo de datos sobre TCP •Texto, imágenes, audio, vídeo… •Permisos
  • 29. Servidor -Conexión varlistenSocket= new StreamSocketListener(); listenSocket.ConnectionReceived+= ConnectionReceived; awaitlistenSocket.BindServiceNameAsync("5000");
  • 30. Servidor -Recepción DataReaderreader= new DataReader(connectionSocket.InputStream); uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); if(sizeFieldCount!= sizeof(long)) return; uintresultLength= (uint)reader.ReadInt32(); uintactualResultLength= awaitreader.LoadAsync(resultLength); if(resultLength!= actualResultLength) return; varbyteResult= new byte[resultLength]; reader.ReadBytes(byteResult);
  • 31. Servidor -Recepción DataReaderreader= new DataReader(connectionSocket.InputStream); uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); if(sizeFieldCount!= sizeof(long)) return; uintresultLength= (uint)reader.ReadInt32(); uintactualResultLength= awaitreader.LoadAsync(resultLength); if(resultLength!= actualResultLength) return; varbyteResult= new byte[resultLength]; reader.ReadBytes(byteResult);
  • 32. Servidor -Recepción uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); if(sizeFieldCount!= sizeof(long)) return; uintresultLength= (uint)reader.ReadInt32(); uintactualResultLength= awaitreader.LoadAsync(resultLength); if(resultLength!= actualResultLength) return; varbyteResult= new byte[resultLength]; reader.ReadBytes(byteResult);
  • 33. Cliente -Conexión varconnectionSocket= new StreamSocket(); varserverHost= new HostName(server); awaitconnectionSocket.ConnectAsync(serverHost, port);
  • 34. Cliente -Envío varwriter= new DataWriter(connectionSocket.OutputStream); writer.WriteInt32(bytes.Length); writer.WriteBytes(bytes); awaitwriter.StoreAsync(); writer.DetachStream();
  • 35. Cliente -Envío varwriter= new DataWriter(connectionSocket.OutputStream); writer.WriteInt32(bytes.Length); writer.WriteBytes(bytes); awaitwriter.StoreAsync(); writer.DetachStream();
  • 36. Cliente -Envío varwriter= new DataWriter(connectionSocket.OutputStream); writer.WriteInt32(bytes.Length); writer.WriteBytes(bytes); awaitwriter.StoreAsync(); writer.DetachStream();
  • 37. Ejemplo completo DEMO WinRTC# WinRTC# Socket
  • 38. StreamSockets •Flujo de datos sobre TCP •Texto, imágenes, audio, vídeo… •Requiere permisos
  • 39. En las profundidades Imagen: https://flic.kr/p/48XdaQ
  • 40. PebbleSmartwatch •iOS & Android •APIs •SDK •Bluetooth!
  • 41. Las cosas no siempre salen como esperamos Imagen: https://flic.kr/p/8bDAS1
  • 42. Volvamos a la RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 43. Volvamos a la RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 44. Volvamos a la RaspberryPI •ARM •Linux •USB + Bluetooth •Ethernet •Sensores
  • 45. Bluetooth IS EVIL •P2P •Alcance •Consumo •Servicios •Ancho de banda •Pairing, Búsqueda, Conexión
  • 46. Servidor server_sock=BluetoothSocket( RFCOMM ) server_sock.bind(("",22)) server_sock.listen(22) client_sock, client_info= server_sock.accept() whileTrue: data = client_sock.recv(1024) client_sock.close() server_sock.close()
  • 47. Servidor server_sock=BluetoothSocket( RFCOMM ) server_sock.bind(("",22)) server_sock.listen(22) client_sock, client_info= server_sock.accept() whileTrue: data = client_sock.recv(1024) client_sock.close() server_sock.close()
  • 48. Servidor server_sock=BluetoothSocket( RFCOMM ) server_sock.bind(("",22)) server_sock.listen(22) client_sock, client_info= server_sock.accept() whileTrue: data = client_sock.recv(1024) client_sock.close() server_sock.close()
  • 49. Cliente -Búsqueda chatServiceInfoCollection= awaitDeviceInformation.FindAllAsync( RfcommDeviceService.GetDeviceSelector( RfcommServiceId.SerialPort));
  • 50. Cliente –Conexión varchatServiceInfo= chatServiceInfoCollection[0]; varservice= awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); awaitchatSocket.ConnectAsync( service.ConnectionHostName, service.ConnectionServiceName); varchatWriter= new DataWriter(chatSocket.OutputStream); varchatReader= new DataReader(chatSocket.InputStream);
  • 51. Cliente –Conexión varchatServiceInfo= chatServiceInfoCollection[0]; varservice= awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); awaitchatSocket.ConnectAsync( service.ConnectionHostName, service.ConnectionServiceName); varchatWriter= new DataWriter(chatSocket.OutputStream); varchatReader= new DataReader(chatSocket.InputStream);
  • 52. Cliente –Conexión varchatServiceInfo= chatServiceInfoCollection[0]; varservice= awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); awaitchatSocket.ConnectAsync( service.ConnectionHostName, service.ConnectionServiceName); varchatWriter= new DataWriter(chatSocket.OutputStream); varchatReader= new DataReader(chatSocket.InputStream);
  • 53. Cliente –Envío y recepción chatWriter.WriteString("open"); awaitchatWriter.StoreAsync(); byte[] buffer = new byte[10]; awaitchatSocket.InputStream.ReadAsync( buffer.AsBuffer(), 10, InputStreamOptions.Partial); stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
  • 54. Cliente –Envío y recepción chatWriter.WriteString("open"); awaitchatWriter.StoreAsync(); byte[] buffer = new byte[10]; awaitchatSocket.InputStream.ReadAsync( buffer.AsBuffer(), 10, InputStreamOptions.Partial); stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
  • 55. Ejemplo completo DEMO C# Python Bluetooth Serial Port
  • 56. Bluetooth IS STILL EVIL •P2P •Alcance •Consumo •Servicios •Ancho de banda •Pairing, Búsqueda, Conexión
  • 57. Podemos comunicarnuestras apps con el mundo exterior
  • 58. WebSockets, sockets, bluetooth, GPS, infrarrojos, sonido, NFC, sensores
  • 60. Gracias! Enlaces, código y slidesen rlbisbe.net roberto.luis@rlbisbe.net @rlbisbe