0% found this document useful (0 votes)
7 views2 pages

5.web Services For IoT

The document discusses Web Application Messaging Protocol (WAMP) for IoT, detailing its components such as transport, session, client roles (publisher, subscriber, caller, callee), and router roles (broker, dealer). It also provides an example of using the Boto Python package to connect to Amazon EC2, demonstrating how to launch an EC2 instance by specifying necessary parameters. The document serves as a guide for implementing web services in IoT applications.

Uploaded by

vinayak457
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

5.web Services For IoT

The document discusses Web Application Messaging Protocol (WAMP) for IoT, detailing its components such as transport, session, client roles (publisher, subscriber, caller, callee), and router roles (broker, dealer). It also provides an example of using the Boto Python package to connect to Amazon EC2, demonstrating how to launch an EC2 instance by specifying necessary parameters. The document serves as a guide for implementing web services in IoT applications.

Uploaded by

vinayak457
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Web Services for IoT UNIT-V

5.4 Web Services for IoT


5.4.1 WAMP:
Web Application Messaging Protocol (WAMP) is a sub-protocol of Websocket which
provides publish-subscribe and remote procedure call (RPC) messaging patterns.

Figure 5.10: WAMP Architecture

• Transport: Transport is channel that connects two peers.


• Session: Session is a conversation between two peers that runs over a transport.
• Client: Clients are peers that can have one or more roles. In publish-subscribe model client
can have following roles:
– Publisher: Publisher publishes events (including payload) to the topic maintained by the
Broker.
– Subscriber: Subscriber subscribes to the topics and receives the events including the
payload.
In RPC model client can have following roles:
– Caller: Caller issues calls to the remote procedures along with call arguments.
– Callee: Callee executes the procedures to which the calls are issued by the caller and returns
the results back to the caller.
• Router: Routers are peers that perform generic call and event routing. In publish-subscribe
model Router has the role of
a Broker:
– Broker: Broker acts as a router and routes messages published to a topic to all subscribers
subscribed to the topic.
In RPC model Router has the role of a Broker:

MRITS/II-II/CSE-IoT/Sensors and Devices 9


Web Services for IoT UNIT-V

– Dealer: Dealer acts a router and routes RPC calls from the Caller to the Callee and routes
results from Callee to Caller.
• Application Code: Application code runs on the Clients (Publisher, Subscriber, Callee or
Caller).

5.4.2 Amazon EC2 – Python Example:


➢ Boto is a Python package that provides interfaces to Amazon Web Services (AWS).
➢ In this example, a connection to EC2 service is first established by calling
boto.ec2.connect_to_region.
➢ The EC2 region, AWS access key and AWS secret key are passed to this function.
After connecting to EC2 , a new instance is launched using the conn.run_instances
function.
➢ The AMI-ID, instance type, EC2 key handle and security group are passed to this
function.
#Python program for launching an EC2 instance
import boto.ec2
from time import sleep
ACCESS_KEY="<enter access key>"
SECRET_KEY="<enter secret key>"
REGION="us-east-1"
AMI_ID = "ami-d0f89fb9"
EC2_KEY_HANDLE = "<enter key handle>"
INSTANCE_TYPE="t1.micro"
SECGROUP_HANDLE="default"
conn = boto.ec2.connect_to_region(REGION, aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY)
reservation = conn.run_instances(image_id=AMI_ID, key_name=EC2_KEY_HANDLE,
instance_type=INSTANCE_TYPE,
security_groups = [ SECGROUP_HANDLE, ] )

MRITS/II-II/CSE-IoT/Sensors and Devices 10

You might also like