An unconventional tutorial to basic socket.io features. Socket.io basic features are explained first of all taking a look directly at the browser (hacker approach) and then taking a look at the documentation (and some code examples).
Socket.IO is a real-time application framework that provides bi-directional communication between web clients and servers through websockets. It allows for low-latency communication and events to be sent and received between clients and servers. The Socket.IO API provides simple methods for attaching event listeners and emitting events on both the client and server sides to enable real-time applications.
This document discusses using Docker and Docker Compose to run a CKAN instance for managing open data. It covers cloning the docker-bodik repository, setting environment variables, bringing up the containers, and extending CKAN with custom plugins.
The document discusses using Socket.IO to create real-time web applications. It outlines the challenges of maintaining persistent connections between clients and servers across browsers. Socket.IO provides a wrapper that supports different transport mechanisms like websockets, flash sockets, and long polling. The document provides code examples for setting up a basic Socket.IO server, handling client connections, broadcasting and receiving messages, and detecting disconnections.
This document discusses Content Security Policy (CSP) and strategies for implementing it effectively. It begins with an introduction to CSP and its goals of mitigating risk, reducing privileges, and detecting exploitation. It then covers common CSP policies, mistakes that can undermine security, and ways attacks can bypass CSP restrictions. The document proposes using strict nonce-based CSP with the 'unsafe-dynamic' feature to more easily deploy CSP without whitelists. It concludes with success stories of this approach and a call for feedback on CSP strategies.
Is your code secure? Do you know what are the practices in secure code review? In this talk you will see the important aspects of the various controls to build a reference when conducting secure code reviews in PHP.
This document discusses local file inclusion (LFI) vulnerabilities that can allow attackers to execute remote code. It explains how LFI works by dynamically including user-supplied files, and how attackers can use path traversal and null bytes to read arbitrary local files. It then describes how attackers can use LFI to execute reverse shells on the target server by including a PHP script that opens a remote connection. The document provides examples of vulnerable PHP functions and common files that can be read. It concludes by recommending input validation and whitelisting of allowed files to defend against LFI attacks.
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019confluent
Cloud migration: it's practically a rite of passage for anyone who's built infrastructure on bare metal. When we migrated our 5-year-old Kafka deployment from the datacenter to GCP, we were faced with the task of making our highly mutable server infrastructure more cloud-friendly. This led to a surprising decision: we chose to run our Kafka cluster on Kubernetes. I'll share war stories from our Kafka migration journey, explain why we chose Kubernetes over arguably simpler options like GCP VMs, and present the lessons we learned while making our way toward a stable and self-healing Kubernetes deployment. I'll also go through some improvements in the more recent Kafka releases that make upgrades crucial for any Kafka deployment on immutable and ephemeral infrastructure. You'll learn what happens when you try to run one complex distributed system on top of another, and come away with some handy tricks for automating cloud cluster management, plus some migration pitfalls to avoid. And if you're not sure whether running Kafka on Kubernetes is right for you, our experiences should provide some extra data points that you can use as you make that decision.
This document summarizes the new features and changes in version 0.7 of the Socket.IO library. Key updates include a complete API rewrite, support for multiple processes, a new messaging protocol with flags for different message types, acknowledgments between client and server, namespacing to allow multiplexing, handshake support for sessions, shared code modules between client and server, and testing on both the client and server. The release of version 0.7 is planned for this week.
This document provides an overview of Socket.IO, a JavaScript library for real-time web applications. It discusses what Socket.IO is, how it provides persistent connections and real-time functionality across browsers including older versions of Internet Explorer. It also summarizes how to install and use Socket.IO on both the client-side and server-side as well as how to send and receive events. Key features like broadcasting messages, acknowledgements, and configurations are also highlighted. Upcoming releases like optimizations, gzip support, and integration with Redis for scaling are mentioned as well.
The document discusses using Socket.IO to create real-time web applications. It outlines the challenges of maintaining persistent connections between clients and servers across browsers. Socket.IO provides a wrapper that supports different transport mechanisms like websockets, flash sockets, and long polling. The document provides code examples for setting up a basic Socket.IO server, handling client connections, broadcasting and receiving messages, and detecting disconnections.
This document discusses Content Security Policy (CSP) and strategies for implementing it effectively. It begins with an introduction to CSP and its goals of mitigating risk, reducing privileges, and detecting exploitation. It then covers common CSP policies, mistakes that can undermine security, and ways attacks can bypass CSP restrictions. The document proposes using strict nonce-based CSP with the 'unsafe-dynamic' feature to more easily deploy CSP without whitelists. It concludes with success stories of this approach and a call for feedback on CSP strategies.
Is your code secure? Do you know what are the practices in secure code review? In this talk you will see the important aspects of the various controls to build a reference when conducting secure code reviews in PHP.
This document discusses local file inclusion (LFI) vulnerabilities that can allow attackers to execute remote code. It explains how LFI works by dynamically including user-supplied files, and how attackers can use path traversal and null bytes to read arbitrary local files. It then describes how attackers can use LFI to execute reverse shells on the target server by including a PHP script that opens a remote connection. The document provides examples of vulnerable PHP functions and common files that can be read. It concludes by recommending input validation and whitelisting of allowed files to defend against LFI attacks.
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019confluent
Cloud migration: it's practically a rite of passage for anyone who's built infrastructure on bare metal. When we migrated our 5-year-old Kafka deployment from the datacenter to GCP, we were faced with the task of making our highly mutable server infrastructure more cloud-friendly. This led to a surprising decision: we chose to run our Kafka cluster on Kubernetes. I'll share war stories from our Kafka migration journey, explain why we chose Kubernetes over arguably simpler options like GCP VMs, and present the lessons we learned while making our way toward a stable and self-healing Kubernetes deployment. I'll also go through some improvements in the more recent Kafka releases that make upgrades crucial for any Kafka deployment on immutable and ephemeral infrastructure. You'll learn what happens when you try to run one complex distributed system on top of another, and come away with some handy tricks for automating cloud cluster management, plus some migration pitfalls to avoid. And if you're not sure whether running Kafka on Kubernetes is right for you, our experiences should provide some extra data points that you can use as you make that decision.
This document summarizes the new features and changes in version 0.7 of the Socket.IO library. Key updates include a complete API rewrite, support for multiple processes, a new messaging protocol with flags for different message types, acknowledgments between client and server, namespacing to allow multiplexing, handshake support for sessions, shared code modules between client and server, and testing on both the client and server. The release of version 0.7 is planned for this week.
This document provides an overview of Socket.IO, a JavaScript library for real-time web applications. It discusses what Socket.IO is, how it provides persistent connections and real-time functionality across browsers including older versions of Internet Explorer. It also summarizes how to install and use Socket.IO on both the client-side and server-side as well as how to send and receive events. Key features like broadcasting messages, acknowledgements, and configurations are also highlighted. Upcoming releases like optimizations, gzip support, and integration with Redis for scaling are mentioned as well.
Real-time Web Application with Socket.IO, Node.js, and RedisYork Tsai
This document summarizes a presentation about building real-time web applications using Socket.IO, Node.js, and Redis. It introduces Socket.IO for enabling real-time bidirectional communication across browsers. It then discusses using Redis for data persistence and as a pub/sub messaging system to integrate components and ensure scalability. The document provides code examples and addresses questions about authentication, load balancing, and configurations.
This document summarizes a meetup about using Socket.IO for real-time applications. It discusses limitations of traditional HTTP requests/responses for real-time applications and solutions like long polling, streaming, and websockets. It notes that websockets are ideal but have limitations for older proxies and firewalls. Socket.IO provides an abstraction layer to use the best transport, including websockets, long polling, and streaming. The meetup will demonstrate Socket.IO through examples and code.
Socket.io is a JavaScript library that enables real-time data exchange between a client and server via websockets. It provides a websocket wrapper for Node.js that allows sending and receiving data asynchronously through events. Socket.io supports fallback options to ensure compatibility with older browsers that do not support websockets natively.
The document discusses using Socket.io to add real-time capabilities to web applications. It provides an overview of Socket.io and how to install and use it with Node.js. Examples are given of emitting and receiving events, broadcasting to all connections, and setting up Socket.io with Express.
Realtime web applications with ExpressJS and SocketIOHüseyin BABAL
This document discusses building real-time web applications using ExpressJS and SocketIO. SocketIO allows for bidirectional communication between client and server through websockets. It handles establishing the websocket connection and provides events for sending and receiving data. This enables the server to push updates to clients in real-time without the client repeatedly requesting information. An example given is building a plane status board that updates automatically every time a flight's status changes, rather than requiring the client to check status every second. Key features covered include sending/receiving events, storing client data, namespaces, acknowledgements, broadcasting, and supporting mobile devices.
When I first started out with D3.js 2 years ago, I built things the same way, customising examples and although worked, I was never proud of my code. The chaining of methods makes the graphs concise, but costs a lot in cognitive overload and maintainability. Building this way is painful to modify, reuse or even to understand once you sit back down after lunch!
I had a huge revelation when I discovered the Reusable API (a modular structure to create and reuse d3 elements) and my code was elevated to even higher levels with Test Driven Development.
In this session I'll walk you through my journey toward beautiful, maintainable D3 graphs with step by step examples of refactoring crufty code to be shiny and new and testable.
By the end of the talk you too will know how to build decoupled, composable, encapsulated and consistent D3 graphs and be proud of your code again!
Data visualization involves tools for visualizing and exploring data. D3.js is a popular JavaScript library for producing dynamic, interactive data visualizations in web browsers. This document lists D3.js as a data visualization tool and provides a link to its website for more information.
The document summarizes an agenda for a presentation on building a MEAN stack application with MongoDB. It discusses designing schemas in MongoDB, using the MEAN stack, visualizing MongoDB data with tools like D3.js and NVD3.js, scalability and availability with MongoDB, and deployment architectures and operations.
Web in real time - technical project - socket.ioThomas Ferney
Socket.io allows for real-time communication between web applications using WebSockets. It provides an abstraction for implementing real-time functionality in applications built with Node.js. Socket.io uses various techniques like polling, long polling, and WebSockets for real-time communication between client and server. Examples are given of implementing a simple chat application using Socket.io with Node.js to establish real-time connections between clients and broadcast messages. Real-time applications like monitoring dashboards and collaborative shopping lists are discussed as demonstrations of using Socket.io.
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014Stéphane ESCANDELL
Presentation used as a support for the "Move you NodeJS application on the cloud" session on the DWX 2014.
Contains detailed informations on how to start from a local working application to a fully scalable and highly available one on Microsoft Azure Cloud.
See the Github associated project: https://github.com/brainsonic/AzureJSChat where you can find all source code:
> local branch: the application running on a local machine or a "classic" server
> azure-servicebus: the application "almost ready" for use with Azure Service Bus (will be updated)
> azure-redis: the application fully working on Azure Web Sites synchronizing data through Azure Redis Cache service and Azure Table Storage
This document discusses websockets and the Ratchet PHP library for implementing websockets. It begins with an introduction to websockets and their benefits over traditional HTTP connections. It then discusses browser support, introduces the Ratchet library, and provides an example of the basic implementation which involves setting up a server, implementing a message component interface, and handling real-time messaging. Some difficulties of websockets like security and latency are also mentioned. Code examples and references are provided at the end.
Socket.io is a Node.js module for real-time data exchange between a server and client. It allows for real-time communication using various transport methods like WebSocket. Socket.io avoids unnecessary requests, unlike traditional polling. It works across browsers and platforms. To use Socket.io, install it on the server, code event handling and signaling on both the server and client-side JavaScript. When an event occurs, like logging in, data can be emitted and received in real-time.
Socket programming allows applications to communicate over a network. Sockets provide an interface between applications and the network. There are two main types of sockets: SOCK_STREAM for reliable, ordered connections and SOCK_DGRAM for unreliable datagrams. A socket is created with the socket() call and configured with bind() and connect()/listen()+accept() for servers and clients respectively. Data is sent and received with send()/recv() or sendto()/recvfrom().
Fun with D3.js: Data Visualization Eye Candy with Streaming JSONTomomi Imura
The document discusses creating dynamic bubble charts using D3.js and streaming JSON data from PubNub. It explains how to (1) create a static bubble chart with D3, (2) make the chart dynamic by subscribing to a PubNub data stream and updating the bubbles on new data, and (3) add smooth transitions as bubbles enter, update, and exit using D3's data binding and transition methods. The full article provides more details on implementing this dynamic bubble chart with animated transitions between data updates.
Node.js and MongoDB are a good fit as MongoDB provides a high-fidelity data store for Node.js applications. To get started quickly, use Nave to manage Node.js versions, npm to manage packages, Express as a web framework, Mongoose as an ODM, and EJS for templating. Key steps include setting up Bootstrap, adding authentication with Mongoose-Auth, and defining schemas like a Link schema for data.
The cross-browser, cross-device WebSocket API Socket.IO solves differences between browsers to provide a consistent API for real-time applications. It supports bi-directional communication over WebSocket, Flash, AJAX long-polling and other transports. Socket.IO is simple to use, supports older browsers, and adds features like disconnection handling that standard WebSocket does not provide. It has been used successfully in several production applications to handle thousands of simultaneous connections.
This document provides an overview of the Tornado web server and summarizes its internals. It begins with an introduction to Tornado, describing it as a scalable, non-blocking web server and framework written in Python. It then outlines the main Tornado modules and discusses sockets, I/O monitoring using select, poll and epoll, and how Tornado sets up its server loop and handles requests.
The document discusses Node.js and provides instructions for installing Node.js via different methods:
1) Homebrew can be used to install Node.js on OSX by running "brew install node.js".
2) nDistro allows creating and installing Node.js distributions within seconds by specifying module and Node binary version dependencies in a .ndistro file.
3) Node.js can be compiled from source by cloning the Node.js repository via git or downloading the source, running configuration, make, and make install commands.
This document provides an overview of network programming in Python. It discusses how Python allows both low-level socket access for building clients and servers as well as higher-level access to application protocols like FTP and HTTP. It then describes socket programming concepts like domains, types, protocols and functions for binding, listening, accepting, connecting, sending and receiving data. Simple client and server code examples are provided to demonstrate creating a basic socket connection between two programs. Finally, commonly used Python network modules for protocols like HTTP, FTP, SMTP and more are listed.
How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...Ritta Narita
To create a multiprocess server on Windows with Ruby, there are a few key steps:
1. Use the spawn method instead of fork to create worker processes since fork is not available on Windows.
2. Use the fiddle library to call Windows API functions like WSADuplicateSocketA to share sockets between processes.
3. Call rb_w32_wrap_io_handle to convert sockets to file descriptors and allow using them with Ruby socket methods.
4. Use TCPServer instead of Unix domain sockets for inter-process communication due to the lack of UDS on Windows.
Exploring the Internet of Things Using RubyMike Hagedorn
The document discusses exploring the Internet of Things using Ruby. It covers using Ruby and USB to control a lamp, creating an IoT printer that prints tasks from a Mac, and building an IoT display to show tweets. It demonstrates connecting various devices like Arduino boards to the cloud and controlling them remotely through Ruby scripts and APIs.
The document is a presentation about Node.js, a JavaScript runtime built on Chrome's V8 JavaScript engine. It discusses how Node.js uses an event-driven, non-blocking I/O model that makes it particularly suited for real-time web applications and I/O-intensive applications compared to traditional threaded server models. It provides examples of Node.js features like asynchronous I/O, event loops, modules and the npm package manager.
The document discusses a TCP server and client example for looking up zip codes. It provides code for a server that listens for connections on port 6000 and responds to "ZipCode" and "Quit" commands by looking up zip codes from a file and disconnecting. It also provides code for a client that connects to the server, sends zip code lookup requests, reads the responses, and disconnects. Key aspects covered include using blocking sockets, threading models in Indy servers, and how the examples can be tested using Telnet.
Exploring Async PHP (SF Live Berlin 2019)dantleech
(note slides are missing animated gifs and video)
As PHP programmers we are used to waiting for network I/O, in general we may not even consider any other option. But why wait? Why not jump on board the Async bullet-train and experience life in the fast lane and give Go and NodeJS a run for the money. This talk will aim to make the audience aware of the benefits, opportunities, and pitfalls of asynchronous programming in PHP, and guide them through the native functionality, frameworks and PHP extensions though which it can be facilitated.
Original slides from Ryan Dahl's NodeJs intro talkAarti Parikh
These are the original slides from the nodejs talk. I was surprised not find them on slideshare so adding them. The video link is here https://www.youtube.com/watch?v=ztspvPYybIY
The document discusses keyboard and file access in Java using input streams, readers, and buffers. It then covers socket programming in Java to connect to other computers over a network. A client-server model is described where the client connects to the server, which listens for connections on a port. The server accepts the connection and a separate socket is used to communicate with that client.
The document discusses how ransomware works by encrypting files on a victim's computer and demanding payment to decrypt the files. It explains the basic process of how ransomware encrypts files, displays a ransom message, and transmits encryption keys to the attacker. The document also provides examples of code that could be used to implement various functions required for a basic ransomware program, such as generating encryption keys, encrypting files, and displaying messages. Finally, it discusses techniques malware developers use to avoid detection by antivirus software.
Things you should know about Node.js. An open-source, cross-platform JavaScript runtime environment for developing a diverse variety of tools and applications.
Demo files: https://github.com/bedis-elacheche/node-workshop-12.16
Node.js is a server-side JavaScript platform that allows building scalable network applications quickly. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js runs on a single thread event loop, handles concurrent connections without blocking and takes advantage of asynchronous programming. It is commonly used for real-time applications that require two-way communication between client and server like chat, streaming etc.
Mathilde Lemée & Romain Maton
La théorie, c’est bien, la pratique … aussi !
Venez nous rejoindre pour découvrir les profondeurs de Node.js !
Nous nous servirons d’un exemple pratique pour vous permettre d’avoir une premiere experience complete autour de Node.js et de vous permettre de vous forger un avis sur ce serveur Javascript qui fait parler de lui !
http://soft-shake.ch/2011/conference/sessions/incubator/2011/09/01/hands-on-nodejs.html
Node.js is an asynchronous I/O library for JavaScript that aims to provide an easy way to build scalable network programs. It keeps slow operations from blocking other operations through non-blocking I/O and by utilizing a single-threaded event loop model. This allows Node.js applications to handle a large number of concurrent connections using a single process, without the overhead of threads. CommonJS modules provide portability for JavaScript libraries between Node.js and other environments like browsers.
How to build a chat application with react js, nodejs, and socket.ioKaty Slemon
In the tutorial, we will learn about how to build a chat app using ReactJs, NodeJS, and Socket.IO. Clone the Github repository and play around with the code.
This document provides an overview of client-server networking concepts in Java. It discusses elements like network basics, ports and sockets. It explains how to implement both TCP and UDP clients and servers in Java using socket classes. Sample code is provided for an echo client-server application using TCP and a quote client-server application using UDP. Exception handling for sockets is also demonstrated.
Talk given at DomCode meetup in Utrecht (August 2014) on different frameworks to do asynchronous I/O y Python, with a strong focus on asyncio (PEP-3156).
Reliable Vancouver Web Hosting with Local Servers & 24/7 Supportsteve198109
Looking for powerful and affordable web hosting in Vancouver? 4GoodHosting offers premium Canadian web hosting solutions designed specifically for individuals, startups, and businesses across British Columbia. With local data centers in Vancouver and Toronto, we ensure blazing-fast website speeds, superior uptime, and enhanced data privacy—all critical for your business success in today’s competitive digital landscape.
Our Vancouver web hosting plans are packed with value—starting as low as $2.95/month—and include secure cPanel management, free domain transfer, one-click WordPress installs, and robust email support with anti-spam protection. Whether you're hosting a personal blog, business website, or eCommerce store, our scalable cloud hosting packages are built to grow with you.
Enjoy enterprise-grade features like daily backups, DDoS protection, free SSL certificates, and unlimited bandwidth on select plans. Plus, our expert Canadian support team is available 24/7 to help you every step of the way.
At 4GoodHosting, we understand the needs of local Vancouver businesses. That’s why we focus on speed, security, and service—all hosted on Canadian soil. Start your online journey today with a reliable hosting partner trusted by thousands across Canada.
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingsteve198109
Vancouver in 2025 is more than scenic views, yoga studios, and oat milk lattes—it’s a thriving hub for eco-conscious entrepreneurs looking to make a real difference. If you’ve ever dreamed of launching a purpose-driven business, now is the time. Whether it’s urban mushroom farming, upcycled furniture sales, or vegan skincare sold online, your green idea deserves a strong digital foundation.
The 2025 Canadian eCommerce landscape is being shaped by trends like sustainability, local innovation, and consumer trust. To stay ahead, eco-startups need reliable hosting that aligns with their values. That’s where 4GoodHosting.com comes in—one of the top-rated Vancouver web hosting providers of 2025. Offering secure, sustainable, and Canadian-based hosting solutions, they help green entrepreneurs build their brand with confidence and conscience.
As eCommerce in Canada embraces localism and environmental responsibility, choosing a hosting provider that shares your vision is essential. 4GoodHosting goes beyond just hosting websites—they champion Canadian businesses, sustainable practices, and meaningful growth.
So go ahead—start that eco-friendly venture. With Vancouver web hosting from 4GoodHosting, your green business and your values are in perfect sync.
DNS Resolvers and Nameservers (in New Zealand)APNIC
Geoff Huston, Chief Scientist at APNIC, presented on 'DNS Resolvers and Nameservers in New Zealand' at NZNOG 2025 held in Napier, New Zealand from 9 to 11 April 2025.
Smart Mobile App Pitch Deck丨AI Travel App Presentation Templateyojeari421237
🚀 Smart Mobile App Pitch Deck – "Trip-A" | AI Travel App Presentation Template
This professional, visually engaging pitch deck is designed specifically for developers, startups, and tech students looking to present a smart travel mobile app concept with impact.
Whether you're building an AI-powered travel planner or showcasing a class project, Trip-A gives you the edge to impress investors, professors, or clients. Every slide is cleanly structured, fully editable, and tailored to highlight key aspects of a mobile travel app powered by artificial intelligence and real-time data.
💼 What’s Inside:
- Cover slide with sleek app UI preview
- AI/ML module implementation breakdown
- Key travel market trends analysis
- Competitor comparison slide
- Evaluation challenges & solutions
- Real-time data training model (AI/ML)
- “Live Demo” call-to-action slide
🎨 Why You'll Love It:
- Professional, modern layout with mobile app mockups
- Ideal for pitches, hackathons, university presentations, or MVP launches
- Easily customizable in PowerPoint or Google Slides
- High-resolution visuals and smooth gradients
📦 Format:
- PPTX / Google Slides compatible
- 16:9 widescreen
- Fully editable text, charts, and visuals
Understanding the Tor Network and Exploring the Deep Webnabilajabin35
While the Tor network, Dark Web, and Deep Web can seem mysterious and daunting, they are simply parts of the internet that prioritize privacy and anonymity. Using tools like Ahmia and onionland search, users can explore these hidden spaces responsibly and securely. It’s essential to understand the technology behind these networks, as well as the risks involved, to navigate them safely. Visit https://torgol.com/
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC
Joyce Chen, Senior Advisor, Strategic Engagement at APNIC, presented on 'APNIC Policy Development Process' at the Local APIGA Taiwan 2025 event held in Taipei from 19 to 20 April 2025.
Best web hosting Vancouver 2025 for you businesssteve198109
Vancouver in 2025 is more than scenic views, yoga studios, and oat milk lattes—it’s a thriving hub for eco-conscious entrepreneurs looking to make a real difference. If you’ve ever dreamed of launching a purpose-driven business, now is the time. Whether it’s urban mushroom farming, upcycled furniture sales, or vegan skincare sold online, your green idea deserves a strong digital foundation.
The 2025 Canadian eCommerce landscape is being shaped by trends like sustainability, local innovation, and consumer trust. To stay ahead, eco-startups need reliable hosting that aligns with their values. That’s where 4GoodHosting.com comes in—one of the top-rated Vancouver web hosting providers of 2025. Offering secure, sustainable, and Canadian-based hosting solutions, they help green entrepreneurs build their brand with confidence and conscience.
As eCommerce in Canada embraces localism and environmental responsibility, choosing a hosting provider that shares your vision is essential. 4GoodHosting goes beyond just hosting websites—they champion Canadian businesses, sustainable practices, and meaningful growth.
So go ahead—start that eco-friendly venture. With Vancouver web hosting from 4GoodHosting, your green business and your values are in perfect sync.
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC
Terry Sweetser, Training Delivery Manager (South Asia & Oceania) at APNIC presented an APNIC update at NZNOG 2025 held in Napier, New Zealand from 9 to 11 April 2025.
2. Hello!
I am Andrea Tarquini
I am a full stack developer (mainly
working with MEAN stack) and an IT
(security) geek and fan.
Follow me at:
@h4t0n
h4t0n
Andrea Tarquini
blog.h4t0n.com
3. socket.io an unconventional tutorial -- PART 1
We’ll see a socket.io simple introduction:
1. how it works (hacker style)
○ taking a look at what happens within the browser
2. get started with socket.io
○ some references to good starting points for
beginners (but not followed by this tutorial)
3. how it works (engineer style)
○ writing some application examples from the official
documentation
4. Before starting… What is Socket.io ?
■ Essentially a fast real time engine
■ It enables real-time bidirectional event-
based communication
■ It works on every platform, browser, device.
■ Mainly used for
○ Instant messaging and chat
○ Document collaboration
○ Binary streaming (image/video/audio… )
from version 1.0
5. 1.
How it works (hacker style)
Let’s start taking a look at what
happens within the browser
8. There are two socket.io realtime connections
One for slack
9. There are two socket.io realtime connections
One for tweets
10. There are some strange requests….
Both the socket.io connections
■ start with xhr-polling (long polling)
■ then switch to websocket transport (if supported)
[more info here]
11. Let’s see the web socket data for tweets..
We have some control data and we can also
identify the tweets seen in the home page
14. … but let’s see what happened using the console
A lot of data → control, messages and events
15. What have we learned from the client (browser)?
Events
The client listen to events
notifications and also emits
events. In the chat example,
events are:
■ client → server
○ typing
○ stop typing
○ new message
■ server → client
○ typing
○ user left
○ new message
Messages
Each event (listened or
emitted) can have an
associated message that is
the most important content:
■ strings
■ objects / arrays
■ but also (images, audio,...)
○ Buffers
○ Blobs
○ ArrayBuffers
○ Files
16. If you followed me, you have understood
events and messages without reading any
line of code or documentation.
But if you want to play more with the browser I suggest to
take a look at the source code and to use the console with
localStorage.debug=”socket.io-client:*”
to see debug messages (NB: reload the page)
17. That’s all ?
Namespaces
Can be used to assign
different endpoints (paths) to
sockets (default is root / )
It is often used to separate
concerns within an
application. For example:
■ notification namespace
■ chat namespace
Room
Inside a namespace (also the
root) you can define channels
that a socket can join or
leave. For example
■ a channel for a restricted
chat or team
!!!NO!!! The Server has its roles, it can be used to group
sockets in namespaces and rooms
We don’t see here. We’ll see
both in PART 2 !!!!
18. 2.
Get Started with socket.io
Let’s start with the chat application
at socket.io/get-started/chat/
19. The “Hello Word” for Socket.IO !!!!
The socket.io chat application is recommended for beginners to
Socket.IO or Node.js
Follow the tutorial at socket.io/get-started/chat could be very
useful for all and it is highly recommended.
You can get the full chat example code also on Github:
github.com/rauchg/chat-example
ATTENTION!!!!! In the following slides we won’t follow the
chat application, we’ll work with the documentation.
20. 3.
How it works (engineer style)
Let’s follow the official socket.io
documentation at socket.io/docs/
21. Get the sample code from documentation...
You can write your own app with the code
available at socket.io/docs or you can get
and run the code from socket.io-sample
github repository, which contains a list of
samples ready to be executed.
express-sample1 contains the simplest example you can find
on socket.io/docs
22. … code from express-sample1: The Server
// express-sample1/server.js
var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
server.listen(8080, function () {
var port = server.address().port;
console.log('Example app listening on port', port);
});
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
io.on('connection', function (socket) {
socket.emit('news', {
hello: 'world'
});
socket.on('my other event', function (data) {
console.log(data);
});
});
Require dependencies and use socket.io with the
same express Server
Both express and socket.io listen connection on
port 8080 (default host is 0.0.0.0)
Express is used to easily serve the index page
When a client connects, we have a socket instance
that can be used to listen/emit event messages:
● the server emit a message (hello world
object) on the “news” event (only to the just
connected socket)
● the server listen to messages coming from
the “my other event” event
23. … code from express-sample1: The index (html page)
<!-- index.html -->
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8080');
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
</script>
GET the library from the server (it is
automatically served by socket.io)
Connect to socket.io and get a socket to use for
the event based communication
When the client connects, we have a socket
instance that can be used to listen/emit event
messages:
● the client listen to messages coming from the
“news” event
● once one is received the client emit a
message (my data object) to “my other
event” event
24. … code from express-sample1: run the sample
DOWNLOAD THE SAMPLES AND INSTALL NODE DEPENDENCIES
$ git clone [email protected]:h4t0n/socket.io-sample.git
$ cd socket.io-sample
# install package.json dependencies
# including socket.io,express,...
$ npm install
RUN EXPRESS-SAMPLE1
$ node express-sample1/server.js
● now open your browser at http://127.0.0.1:8080
● take a look at browser and server console
25. … code from express-sample1: another type of client
// client.js
var io = require('socket.io-client');
var socket = io.connect('http://localhost:
8080');
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
ATTENTION!!!!! To interact with a socket.io server we don’t need a
browser at all. We can use a standalone Node.js script client.
We have to use the socket.io-client module (already installed in the
previous slide command $ npm install )
TODO!! Run the client more times from several
terminal and take a look at the server console.
26. From the example we have seen how to:
■ create a socket.io server
■ connect to the server by using a browser or a
standalone node app (script)
■ listen and emit event messages
○ from a single client to the server and vice versa
SO… VERY SIMPLE AND BASIC CONCEPTS...
.. .BUT THERE IS MUCH MORE !!!!!!!
27. Socket.io allows also to:
■ emit messages to all the connected clients
■ broadcast messages
○ sending message to everyone else except the socket that
start the communication (that emit an event)
■ send volatile messages
■ send and get acknowledgments
■ listen to other default events
○ such as the disconnect one
■ be used just as a cross browser websocket
○ without events or other socket.io additions
The socket.io/docs overview treats these concepts...
28. express-sample2 is a simple web app that
easily shows other most used features:
■ broadcast messages
■ emit messages to all connected clients
■ listen to disconnect event
■ emit messages without using socket.io
events (just as a cross browser websocket)
…or you can take a look at express-sample2 from socket.
io-sample repository
!!!! SO PLAY WITH EXPRESS-SAMPLE2 !!!
29. ■ namespaces
■ rooms
■ middlewares
■ etcetera…
WE’LL SEE MORE FEATURES AND EXAMPLES IN THE
TUTORIAL PART 2