IOT & CC Unit 5 Mid Prep Notes
IOT & CC Unit 5 Mid Prep Notes
WAMP Protocol:
bash
Copy code
pip install autobahn
python
Copy code
from autobahn.asyncio.wamp import ApplicationSession,
ApplicationRunner
class MyComponent(ApplicationSession):
async def onJoin(self, details):
print("session attached")
if __name__ == '__main__':
runner = ApplicationRunner(url="ws://localhost:8080/ws",
realm="realm1")
runner.run(MyComponent)
• Installation in JavaScript:
o Use npm to install Autobahn:
bash
Copy code
npm install autobahn
javascript
Copy code
var autobahn = require('autobahn');
connection.open();
7. RESTful Web
• HTTP Methods:
o GET: Retrieve data from the server.
o POST: Send data to the server to create a resource.
o PUT: Update an existing resource on the server.
o DELETE: Remove a resource from the server.
POST Create
HTTP verb CRUD action
GET Read
PUT Update
PATCH Update
DELETE Delete
• Uniform Interface: Standardizes the way resources are accessed and manipulated,
using HTTP methods and unique URLs.
• Client-Server: Separates concerns, allowing the client and server to evolve
independently.
• Stateless: Each request from client to server must contain all the necessary
information to process the request.
• Cacheable: Responses must explicitly indicate if they are cacheable to improve
performance.
• Layered System: Allows for a layered architecture where different layers can be
added or modified independently.
• Code on Demand (Optional): Servers can send executable code to clients to extend
their functionality.
• Simplicity: Easy to understand and use due to reliance on standard HTTP protocols.
• Platform Independence: Can be used across different programming languages and
environments.
• Scalability: Stateless nature supports horizontal scaling by distributing requests
across multiple servers.
• Flexibility: Can handle various data formats like JSON, XML, HTML, etc.
• Security: Uses standard HTTP security mechanisms like OAuth, HTTPS, etc.
Common Challenges:
These expanded details should help provide a more comprehensive understanding of the
WAMP protocol, session management, and installation of Autobahn, as well as the
fundamentals and practical aspects of RESTful web services.