15 minutes of OpenSwoole - WebSocket - Part 4
15 minutes of OpenSwoole - WebSocket - Part 4
At this video we will:
- Connect to our WebSocket Server using a ServerS-Side Client.
Previous part: https://www.youtube.com/watch?v=qHZpSGErR3M
Source: https://github.com/Jacked-PHP/sample-ws-server-client/tree/7de2a6ce8fb7e9c6dce6d90e5296ffe53933c4bd
Topics:
00:00 Presentation
00:25 Introduction
02:02 The WebSocket Client
08:16 Results
09:36 Extra Considerations
12:25 Extra 2
--------------------------
References
--------------------------
OpenSwoole Docs: https://openswoole.com
Socket Conveyor: https://socketconveyor.com
Socket Conveyor Client: https://www.npmjs.com/package/socket-conveyor-client
Socket Conveyor Server-Side Client: https://github.com/kanata-php/conveyor-server-client
Laravel Mix: https://laravel-mix.com
WebSocket client which Conveyor Server-Side Client is built on top of: https://github.com/Textalk/websocket-php
--------------------------
Musics
--------------------------
https://uppbeat.io/t/mark-july/today-is-the-day
License code: OFXBO6XCX9BMYMRS
https://uppbeat.io/t/matrika/smack-that
License code: QYBHFMBRLTDGRLRX
https://uppbeat.io/t/pryces/music-is
License code: XFIT6ZBPG0PA48YJ
https://uppbeat.io/t/dan-phillipson/making-progress
License code: 5DZJKPOXUJULNLPS
--------------------------
Errata
--------------------------
In the introduction, it is showing "Client 1" twice. It was supposed to be "Client 1" and "Client 2".
17
views
34 minutes of OpenSwoole - WebSocket - Part 3
34 minutes of OpenSwoole - WebSocket - Part 3
In this video we will:
- Route Socket Messages
Previous part: https://www.youtube.com/watch?v=9qPnPGfAYdo
Source: https://github.com/Jacked-PHP/sample-websocket-server/tree/df7c19473132dae276a471c96471c9822986555b
--------------------------
Topics:
--------------------------
00:00 Presentation
00:44 Dependencies
04:58 Socket Conveyor
08:13 App Back-End
17:21 App Front-End
27:10 Results
29:46 Customizations
--------------------------
References
--------------------------
OpenSwoole Docs: https://openswoole.com
Socket Conveyor: https://socketconveyor.com
Socket Conveyor Client: https://www.npmjs.com/package/socket-conveyor-client
Laravel Mix: https://laravel-mix.com
--------------------------
Music
--------------------------
https://uppbeat.io/t/ben-johnson/cant-stop-chasing-you
License code: YXVXZ1KCWTAGZE1S
https://uppbeat.io/t/matrika/smack-that
License code: QYBHFMBRLTDGRLRX
https://uppbeat.io/t/hartzmann/bamboo
License code: GR0BHUSUJXU5ECBU
3
views
57 minutes of OpenSwoole - WebSocket - Part 2
57 minutes of OpenSwoole - WebSocket - Part 2
At this video we will (on our sample app):
- Build WebSocket Server Command
- Serve HTTP and WebSocket with one Server
- Identify connected users
- Implement real-time communication
App changes:
- added websocket server command
details:
- with static files enabled
- with user identification
- token structure adjusted to count/limit uses
- ui changes
Previous part: https://youtu.be/Vgw5Ibqc15k
Source: https://github.com/Jacked-PHP/sample-swoole/tree/76702d9e7642ec8b849fd82381a10f3067f5a9c3
--------------------------
Topics:
--------------------------
00:00 Initial Description
01:27 WebSocket Command
09:10 Dynamic WebSocket Settings
13:48 User Identification
26:58 Single use Token
30:54 Serving static files
34:34 Token structure adjustment and user identification complementation
44:49 Building the User Interface
52:57 Running the server
53:45 Adding a second user for further tests
--------------------------
References
--------------------------
Video where we covered Plates template engine: https://youtu.be/Xdz_-u6cGTU
Video where we covered JWT tokens: https://youtu.be/O8EVJrKtbGg
--------------------------
Music
--------------------------
https://uppbeat.io/t/ben-johnson/cant-stop-chasing-you
License code: YXVXZ1KCWTAGZE1S
https://uppbeat.io/t/matrika/smack-that
License code: QYBHFMBRLTDGRLRX
https://uppbeat.io/t/hartzmann/bamboo
License code: GR0BHUSUJXU5ECBU
3
views
16 minutes of OpenSwoole - WebSocket - Part 1
16 minutes of OpenSwoole - WebSocket - Part 1
At this video we will:
- Create a Websocket Server
- Accept HTTP Requests with the same Server
- Pushing incoming messages to all connections
- Create a simple WebSocket Client
Previous part: https://www.youtube.com/watch?v=LtdSleQHJhs
Source: https://github.com/Jacked-PHP/sample-websocket-server
--------------------------
References
--------------------------
OpenSwoole Docs: https://openswoole.com/
WebSocket RFC: https://datatracker.ietf.org/doc/html/rfc6455
Plates: http://platesphp.com/
Video where we used plates on our HTTP server: https://www.youtube.com/watch?v=Xdz_-u6cGTU
--------------------------
Musics
--------------------------
https://uppbeat.io/t/ben-johnson/cant-stop-chasing-you
License code: YXVXZ1KCWTAGZE1S
https://uppbeat.io/t/matrika/smack-that
License code: QYBHFMBRLTDGRLRX
https://uppbeat.io/t/hartzmann/bamboo
License code: GR0BHUSUJXU5ECBU
7
views
PHP OpenSwoole HTTP Server - API Part 3
9 minutes of PHP OpenSwoole HTTP Server - Generator
At this video we will:
- API Endpoints with Input Validation
- Tests for our new endpoints
Previous part: https://www.youtube.com/watch?v=290BqW6wpss
Source: https://github.com/lotharthesavior/sample-swoole/tree/cff1dcab10be2833d30dac1de363208ff8d57657
Packages added at this video:
- fakerphp/faker (https://github.com/FakerPHP/Faker)
- symfony/var-dumper (https://github.com/symfony/var-dumper)=
- symfony/password-hasher (https://github.com/symfony/password-hasher)
7
views
PHP OpenSwoole HTTP Server - Model Factory
9 minutes of PHP OpenSwoole HTTP Server - Model Factory
At this video we will:
- Create a Model Factory Generator Command
- Generate our Model Factory
- Tests for our Command
Previous part: https://www.youtube.com/watch?v=hcc-Tf8vNTo
Source: https://github.com/lotharthesavior/sample-swoole/tree/ea145a39ae923f0162068fe6fb793ae7f5324eae
Packages added at this video:
- league/flysystem (https://github.com/thephpleague/flysystem)
- mustache/mustache (https://github.com/bobthecow/mustache.php)
- mockery/mockery (https://github.com/mockery/mockery)
2
views
PHP OpenSwoole HTTP Server - Input Validation Part 2
9 minutes of PHP OpenSwoole HTTP Server - Input Validation Part 2
At this video we will:
- Clone again our app built until this point put it running
- Implement Input Validation for our Login Form with Tests
Previous part: https://youtu.be/XgMCPRGfZK8
Source: https://github.com/lotharthesavior/sample-swoole/tree/68d1f3454f39e9a324134c10fb5afd7c57bed1cd
2
views
PHP OpenSwoole HTTP Server - Input Validation
9 minutes of PHP OpenSwoole HTTP Server - Input Validation
At this video we will:
- Implement Input Validation for our Console Commands
Source: https://github.com/lotharthesavior/sample-swoole/tree/e83abf8a6668dfc2a3233f196c75167244e5a1cd
Packages added here:
- symfony/validator (https://github.com/symfony/validator)
References:
Symfony Validator: https://symfony.com/doc/current/components/validator.html
2
views
PHP OpenSwoole HTTP Server - Code Reorganization
9 minutes of PHP OpenSwoole HTTP Server
Let's reorganize some code!
Source: https://github.com/lotharthesavior/sample-swoole/tree/82576df1e712c436a06b907f86bba876fde81731
Previous part: https://www.youtube.com/watch?v=suUOFOEvzRI
At this video we reorganize some code so we can move forward with some functionalities.
4
views
PHP OpenSwoole HTTP Server - user authorization part 3
9 minutes of PHP OpenSwoole HTTP Server
User Authorization - Part 3
Source: https://github.com/lotharthesavior/sample-swoole/tree/87f291e4417ba8dd1db259dbb104b7fb167a17c8
Previous part: https://www.youtube.com/watch?v=Rk2IknTE9rQ
- Authorization Middleware
- Adding extra information at the session
- Login/Logout forms
- Displaying current logged user's name
3
views
PHP OpenSwoole HTTP Server - user authorization part 2
9 minutes of PHP OpenSwoole HTTP Server
User Authorization - Part 2
Source: https://github.com/lotharthesavior/sample-swoole/tree/809d52b3c7de522bd5e23a60937eef4d0af4d3fd
Starting from route and templating video: https://www.youtube.com/watch?v=Xdz_-u6cGTU
- route groups
- adding logs
- DI Container
- Swoole Table and Psr6 (Cache)
- identifying user making the request with cookies
Reference to Psr6 : https://www.php-fig.org/psr/psr-6/
Added packages:
- ramsey/uuid
- psr/simple-cache
- nesbot/carbon
- lotharthesavior/chocookies
- monolog/monolog
- php-di/slim-bridge
- php-di/php-di
22
views
PHP OpenSwoole HTTP Server - User Authorization Part 1
9 minutes of PHP OpenSwoole
User Authorization - Part 1
Source: https://github.com/lotharthesavior/sample-swoole/tree/1db1e67a0d259cfa14535fb063e05c0a4c916beb
Starting from route and templating video: https://www.youtube.com/watch?v=Xdz_-u6cGTU
- add ps4 autoloading
- using controllers
- add environment variables to your code
- middlewares
- basic mysql connection using PDO
4
views
PHP OpenSwoole HTTP Server - routing and templating
9 minutes of PHP OpenSwoole
Source: https://gist.github.com/lotharthesavior/063d68972ed41be743e7fe7ef347ba84
- Basic Swoole HTTP Server
- Routing
- Templating
9
views
PHP OpenSwoole HTTP Server - build webapps
9 minutes of PHP OpenSwoole
Source: https://gist.github.com/lotharthesavior/330c9bf04f72193c0cd4a8cc7ed11e68
- Basic Swoole HTTP Server
- Query Parameters
- Global Scope Variables
9
views
PHP OpenSwoole HTTP Server - Refactor 1
9 minutes of PHP OpenSwoole HTTP Server - Refactor 1
Observation: We had some other refactors within videos in the past, but this is the first video specific for this.
At this video we will:
- Refactor our command tests to properly handle outputs for future tests,
- Refactor Session Middleware so it supports PHP 8.2 "Deprecate dynamic properties" RFC (https://wiki.php.net/rfc/deprecate_dynamic_properties).
Source: https://github.com/lotharthesavior/sample-swoole/tree/fa731e2516aa638fe58fae34cdd024b17ce6da4f
References:
Deprecate dynamic properties RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
20
views
PHP OpenSwoole HTTP Server - API Part 2 - JWT Authorization
9 minutes of PHP OpenSwoole HTTP Server - API Part 2 - JWT Authorization
At this second part we will create an authorization layer for our API using JWT standard.
Source: https://github.com/lotharthesavior/sample-swoole/tree/42fd2fd1528016179c33f0ee76065fbc1b6e90e1
Previous part: https://youtu.be/1u5Gv-CkNzY
- Part 1: Refactor for our Commands Structure
- Part 2: JWT Authorization (https://youtu.be/O8EVJrKtbGg?t=573)
Packages added here:
- firebase/php-jwt (https://github.com/firebase/php-jwt)
References:
Symfony Console: https://symfony.com/doc/current/components/console.html
JWT RFC (7519): https://datatracker.ietf.org/doc/html/rfc7519
13
views
PHP OpenSwoole HTTP Server - API Part 1 - Tests
9 minutes of PHP OpenSwoole HTTP Server - API Part 1 - Tests
Let's create an API with our App! In this part 1, let's scaffold the tests.
Source: https://github.com/lotharthesavior/sample-swoole/tree/043664a326bcc569f6c6b3c727c5139e6c164a87
Previous part: https://youtu.be/xpxc2NDJ0EU
- API Tests
This video is the first video of a sequence of videos over API topics. Here we add the basic structure and the first test for our API.
Packages added here:
- nekofar/slim-test (https://github.com/nekofar/slim-test)
- phpunit/phpunit (https://phpunit.de/)
- codedungeon/phpunit-result-printer (https://github.com/mikeerickson/phpunit-pretty-result-printer)
2
views
PHP OpenSwoole HTTP Server - Async/Sync Events Part 2
9 minutes of PHP OpenSwoole HTTP Server
Let's Refactor the Event Structure of our App!
Source: https://github.com/lotharthesavior/sample-swoole/tree/50d466e95d7ef76382bbb110109b5297afab99b9
Previous part: https://youtu.be/yPCEFL0UWgY
- Events
At this video we go over the previous video's Events implementation and refactor it to address limitations and to simplify it. We also go ahead and implement sync events.
Limitations addressed:
- listener parameter types: now we accept complex objects instead of just strings
- execute listener callback on demand instead of using an infinite loop
2
views
PHP OpenSwoole HTTP Server - Async Events
9 minutes of PHP OpenSwoole HTTP Server
Let's add Async Events Structure to our App!
Source: https://github.com/lotharthesavior/sample-swoole/tree/493f6e5ad1a299d4e34b778085a836b637d7e7e2
Previous part: https://youtu.be/0d36KYtirTI
- Events
At this video we go over Async Events structure implementation. Our first "extension point mechanism" in this App.
Singleton reference: https://sourcemaking.com/design_patterns/singleton
1
view
PHP OpenSwoole HTTP Server - Eloquent and CLI
9 minutes of PHP OpenSwoole HTTP Server
Here we spent some extra time, and Symfony Console and Laravel Eloquent.
Source: https://github.com/lotharthesavior/sample-swoole/tree/93bff58f873ce39e5c17b4ad8435148ba6a49edc
Previous part: https://youtu.be/e1XfYTSD8q0
- Eloquent with migrations and seeds
- Command line interface
At this video we enhance the bootstrap of our application to add commands, such as migrate and seed, without affecting the existent application http server initialization. After having that prepared, we proceed and add Eloquent with mgiration and seeds while keeping our app working as before.
Packages added here:
- illuminate/database (https://github.com/illuminate/database)
- symfony/console (https://github.com/symfony/console)
2
views
PHP OpenSwoole HTTP Server - Code Reorganization
9 minutes of PHP OpenSwoole HTTP Server
Let's reorganize some code!
Source: https://github.com/lotharthesavior/sample-swoole/tree/82576df1e712c436a06b907f86bba876fde81731
Previous part: https://www.youtube.com/watch?v=suUOFOEvzRI
At this video we reorganize some code so we can move forward with some functionalities.
1
view
PHP OpenSwoole HTTP Server - User Authorization - Part 3
9 minutes of PHP OpenSwoole HTTP Server
User Authorization - Part 3
Source: https://github.com/lotharthesavior/sample-swoole/tree/87f291e4417ba8dd1db259dbb104b7fb167a17c8
Previous part: https://www.youtube.com/watch?v=Rk2IknTE9rQ
- Authorization Middleware
- Adding extra information at the session
- Login/Logout forms
- Displaying current logged user's name
9
views
PHP OpenSwoole HTTP Server - User Authorization - Part 2
9 minutes of PHP OpenSwoole
Errata: at the minute 10:29 ended up pointing to the wrong place when mentioning the default value of TTL on cache table. The 8 hours is specified some place else, on screen is shown only the size of the field on Swoole Table.
User Authorization - Part 2
Source: https://github.com/lotharthesavior/sample-swoole/tree/809d52b3c7de522bd5e23a60937eef4d0af4d3fd
Starting from route and templating video: https://www.youtube.com/watch?v=Xdz_-u6cGTU
- route groups
- adding logs
- DI Container
- Swoole Table and Psr6 (Cache)
- identifying user making the request with cookies
Reference to Psr6 : https://www.php-fig.org/psr/psr-6/
Added packages:
- ramsey/uuid
- psr/simple-cache
- nesbot/carbon
- lotharthesavior/chocookies
- monolog/monolog
- php-di/slim-bridge
- php-di/php-di
11
views
PHP OpenSwoole HTTP Server - User Authorization - Part 1
9 minutes of PHP OpenSwoole
User Authorization - Part 1
Source: https://github.com/lotharthesavior/sample-swoole/tree/1db1e67a0d259cfa14535fb063e05c0a4c916beb
Starting from route and templating video: https://www.youtube.com/watch?v=Xdz_-u6cGTU
- add ps4 autoloading
- using controllers
- add environment variables to your code
- middlewares
- basic mysql connection using PDO
Odysee: https://odysee.com/@anduinscave:d/php-openswoole-user-auth-part-1:3
---------------------------------------
Extra Considerations:
---------------------------------------
1. At the version of this video the "composer.lock" is not in sync with the "composer.json" file, removing the "composer.lock" and running another "composer install" command on terminal will be necessary.
2. According to a command from justus Kamaliki, extra namespaces usage might be necessary at the "start_users_table.php" file. Consider that if you have problems.
17
views