{"id":34466,"date":"2025-11-17T02:40:56","date_gmt":"2025-11-16T23:40:56","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=34466"},"modified":"2025-11-17T02:40:56","modified_gmt":"2025-11-16T23:40:56","slug":"socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/","title":{"rendered":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi"},"content":{"rendered":"<p><body><\/p>\n<h2>Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi<\/h2>\n<p>Ger\u00e7ek zamanl\u0131 uygulamalar, modern web deneyiminin ayr\u0131lmaz bir par\u00e7as\u0131 haline gelmi\u015ftir. Anl\u0131k bildirimler, canl\u0131 sohbet odalar\u0131, \u00e7ok oyunculu oyunlar, finansal grafikler ve i\u015fbirli\u011fine dayal\u0131 ara\u00e7lar gibi bir\u00e7ok alanda kullan\u0131c\u0131 deneyimini zenginle\u015ftiren bu uygulamalar, sunucu ile istemci aras\u0131nda s\u00fcrekli ve h\u0131zl\u0131 bir ileti\u015fim kurma yetene\u011fine dayan\u0131r. Bu makalede, g\u00fc\u00e7l\u00fc bir backend i\u00e7in Node.js, ger\u00e7ek zamanl\u0131 ileti\u015fim i\u00e7in Socket.IO ve dinamik bir kullan\u0131c\u0131 aray\u00fcz\u00fc i\u00e7in Angular&#8217;\u0131 kullanarak s\u0131f\u0131rdan bir ger\u00e7ek zamanl\u0131 uygulama geli\u015ftirmeyi ad\u0131m ad\u0131m inceleyece\u011fiz.<\/p>\n<p>Ger\u00e7ek zamanl\u0131 uygulamalar, kullan\u0131c\u0131lar\u0131n an\u0131nda geri bildirim almas\u0131n\u0131 ve etkile\u015fimde bulunmas\u0131n\u0131 sa\u011flayarak geleneksel &#8220;istek-yan\u0131t&#8221; d\u00f6ng\u00fcs\u00fcn\u00fcn s\u0131n\u0131rlamalar\u0131n\u0131 a\u015far. Bu t\u00fcr uygulamalar, kullan\u0131c\u0131lar\u0131n bir eylemi ger\u00e7ekle\u015ftirdi\u011fi anda veya sunucuda bir veri de\u011fi\u015fikli\u011fi meydana geldi\u011finde, ilgili t\u00fcm istemcilere an\u0131nda bilgi ak\u0131\u015f\u0131n\u0131 m\u00fcmk\u00fcn k\u0131lar. Bu yetenek, kullan\u0131c\u0131 kat\u0131l\u0131m\u0131n\u0131 art\u0131r\u0131r ve daha ak\u0131c\u0131, etkile\u015fimli bir deneyim sunar.<\/p>\n<p>Node.js, asenkron yap\u0131s\u0131 ve olay tabanl\u0131 mimarisi sayesinde ger\u00e7ek zamanl\u0131 uygulamalar i\u00e7in ideal bir backend platformudur. Y\u00fcksek e\u015fzamanl\u0131 ba\u011flant\u0131lar\u0131 d\u00fc\u015f\u00fck gecikmeyle y\u00f6netebilir. Socket.IO, Node.js ekosisteminin en pop\u00fcler ger\u00e7ek zamanl\u0131 k\u00fct\u00fcphanelerinden biridir. WebSocket protokol\u00fcn\u00fc soyutlayarak, taray\u0131c\u0131 uyumlulu\u011fu, otomatik yeniden ba\u011flant\u0131, odalar ve yay\u0131nlama gibi geli\u015fmi\u015f \u00f6zellikler sunar. Angular ise, bile\u015fen tabanl\u0131 mimarisi ve g\u00fc\u00e7l\u00fc veri ba\u011flama yetenekleriyle karma\u015f\u0131k kullan\u0131c\u0131 aray\u00fczlerini olu\u015fturmak i\u00e7in m\u00fckemmel bir se\u00e7imdir. Bu \u00fc\u00e7 teknolojinin birle\u015fimi, hem \u00f6l\u00e7eklenebilir hem de bak\u0131m\u0131 kolay ger\u00e7ek zamanl\u0131 uygulamalar geli\u015ftirmek i\u00e7in sa\u011flam bir temel olu\u015fturur.<\/p>\n<p>Bu rehberde, bir sohbet uygulamas\u0131 \u00f6rne\u011fi \u00fczerinden, Node.js ile bir Socket.IO sunucusu kurmay\u0131, Angular ile bir Socket.IO istemcisi geli\u015ftirmeyi ve bu iki taraf\u0131 birle\u015ftirerek tam te\u015fekk\u00fcll\u00fc bir ger\u00e7ek zamanl\u0131 uygulama olu\u015fturmay\u0131 \u00f6\u011frenece\u011fiz. Ayr\u0131ca, uygulaman\u0131z\u0131 daha g\u00fc\u00e7l\u00fc ve esnek hale getirecek ileri seviye konulara da de\u011finece\u011fiz.<\/p>\n<h2>Ger\u00e7ek Zamanl\u0131 Uygulamalar\u0131n Temelleri<\/h2>\n<p>Ger\u00e7ek zamanl\u0131 uygulamalar\u0131n arkas\u0131ndaki temel prensipleri anlamak, bu t\u00fcr sistemleri etkili bir \u015fekilde geli\u015ftirmek i\u00e7in kritik \u00f6neme sahiptir. Geleneksel web uygulamalar\u0131n\u0131n \u00e7al\u0131\u015fma \u015fekli ile ger\u00e7ek zamanl\u0131 uygulamalar\u0131n ihtiya\u00e7lar\u0131 aras\u0131ndaki fark\u0131 kavramak, do\u011fru teknolojileri se\u00e7memize yard\u0131mc\u0131 olacakt\u0131r.<\/p>\n<h3>Geleneksel HTTP ve Ger\u00e7ek Zamanl\u0131 \u0130htiya\u00e7lar<\/h3>\n<p>Geleneksel web uygulamalar\u0131, HTTP protokol\u00fc \u00fczerine kuruludur ve &#8220;istek-yan\u0131t&#8221; d\u00f6ng\u00fcs\u00fcyle \u00e7al\u0131\u015f\u0131r. Bir istemci (taray\u0131c\u0131), bir sunucuya bir istek g\u00f6nderir ve sunucu bu iste\u011fi i\u015fleyip bir yan\u0131t d\u00f6ner. Bu model, sayfa y\u00fcklemeleri veya form g\u00f6nderimleri gibi tek seferlik veri al\u0131\u015fveri\u015fleri i\u00e7in olduk\u00e7a etkilidir. Ancak, sunucunun istemciye an\u0131nda bilgi g\u00f6ndermesi gerekti\u011finde veya s\u00fcrekli, \u00e7ift y\u00f6nl\u00fc bir ileti\u015fim hatt\u0131na ihtiya\u00e7 duyuldu\u011funda yetersiz kal\u0131r.<\/p>\n<p>\u00d6rne\u011fin, bir sohbet uygulamas\u0131nda her yeni mesaj geldi\u011finde istemcinin sunucuya s\u00fcrekli istek g\u00f6ndermesi (polling) veya sunucunun uzun s\u00fcre bekletip bir yan\u0131t d\u00f6nd\u00fcrmesi (long-polling) gibi y\u00f6ntemler, hem sunucu kaynaklar\u0131n\u0131 verimsiz kullan\u0131r hem de gecikmeye neden olur. Bu y\u00f6ntemler, ger\u00e7ek zamanl\u0131 deneyim i\u00e7in gerekli olan anl\u0131k ileti\u015fimi sa\u011flamakta zorlan\u0131r ve performans sorunlar\u0131na yol a\u00e7abilir.<\/p>\n<h3>WebSocket Protokol\u00fc<\/h3>\n<p>WebSocket protokol\u00fc, HTTP&#8217;nin s\u0131n\u0131rlamalar\u0131n\u0131 a\u015fmak i\u00e7in tasarlanm\u0131\u015ft\u0131r. Tek bir TCP ba\u011flant\u0131s\u0131 \u00fczerinden tam \u00e7ift y\u00f6nl\u00fc (full-duplex) ileti\u015fim kanal\u0131 kurar. Yani, hem istemci sunucuya hem de sunucu istemciye ayn\u0131 anda ve ba\u011f\u0131ms\u0131z olarak veri g\u00f6nderebilir. Bir WebSocket ba\u011flant\u0131s\u0131, ilk el s\u0131k\u0131\u015fma (handshake) tamamland\u0131ktan sonra a\u00e7\u0131k kal\u0131r ve bu sayede s\u00fcrekli bir ileti\u015fim hatt\u0131 sa\u011flan\u0131r. Bu, anl\u0131k veri ak\u0131\u015f\u0131 gerektiren uygulamalar i\u00e7in idealdir.<\/p>\n<p>WebSocket&#8217;in temel avantajlar\u0131 \u015funlard\u0131r:<br \/>\n*   <strong>D\u00fc\u015f\u00fck Gecikme:<\/strong> Ba\u011flant\u0131 bir kez kuruldu\u011funda, ek HTTP ba\u015fl\u0131klar\u0131 olmadan do\u011frudan veri al\u0131\u015fveri\u015fi yap\u0131labilir, bu da gecikmeyi \u00f6nemli \u00f6l\u00e7\u00fcde azalt\u0131r.<br \/>\n*   <strong>Tam \u00c7ift Y\u00f6nl\u00fc \u0130leti\u015fim:<\/strong> \u0130stemci ve sunucu ayn\u0131 anda veri g\u00f6nderip alabilir.<br \/>\n*   <strong>Verimlilik:<\/strong> Ba\u011flant\u0131 a\u00e7\u0131k kald\u0131\u011f\u0131 i\u00e7in her istek i\u00e7in yeni bir ba\u011flant\u0131 kurma maliyeti ortadan kalkar.<br \/>\n*   <strong>Sunucu Taraf\u0131ndan \u0130stemciye \u0130leti\u015fim:<\/strong> Sunucu, istemcinin bir istek g\u00f6ndermesini beklemeden do\u011frudan veri g\u00f6nderebilir.<\/p>\n<h3>Socket.IO Neden Kullan\u0131lmal\u0131?<\/h3>\n<p>WebSocket protokol\u00fc g\u00fc\u00e7l\u00fc olsa da, farkl\u0131 taray\u0131c\u0131lar ve a\u011f ko\u015fullar\u0131 aras\u0131nda tutarl\u0131 bir deneyim sa\u011flamak bazen zor olabilir. \u0130\u015fte burada Socket.IO devreye girer. Socket.IO, WebSocket&#8217;in \u00fczerine in\u015fa edilmi\u015f bir k\u00fct\u00fcphanedir ve ger\u00e7ek zamanl\u0131 uygulamalar geli\u015ftirmeyi \u00e7ok daha kolay hale getirir.<\/p>\n<p>Socket.IO&#8217;nun ba\u015fl\u0131ca avantajlar\u0131:<br \/>\n*   <strong>Taray\u0131c\u0131 Uyumlulu\u011fu ve Fallback Mekanizmalar\u0131:<\/strong> Socket.IO, istemci ve sunucu aras\u0131nda en iyi ileti\u015fim y\u00f6ntemini otomatik olarak se\u00e7er. E\u011fer WebSocket ba\u011flant\u0131s\u0131 m\u00fcmk\u00fcn de\u011filse (eski taray\u0131c\u0131lar veya baz\u0131 a\u011f proxy&#8217;leri nedeniyle), otomatik olarak long-polling gibi di\u011fer y\u00f6ntemlere geri d\u00f6ner. Bu, uygulaman\u0131z\u0131n geni\u015f bir kullan\u0131c\u0131 kitlesi taraf\u0131ndan eri\u015filebilir olmas\u0131n\u0131 sa\u011flar.<br \/>\n*   <strong>Otomatik Yeniden Ba\u011flant\u0131:<\/strong> A\u011f kesintileri veya sunucu yeniden ba\u015flatmalar\u0131 durumunda, Socket.IO istemcisi otomatik olarak sunucuya yeniden ba\u011flanmaya \u00e7al\u0131\u015f\u0131r ve bu s\u00fcre\u00e7te kaybolan verileri kurtarmaya yard\u0131mc\u0131 olabilir.<br \/>\n*   <strong>Mesaj Yay\u0131nlama (Broadcasting) ve Odalar (Rooms):<\/strong> Belirli bir olay\u0131 t\u00fcm ba\u011fl\u0131 istemcilere, belirli bir gruba (oda) veya belirli bir istemciye yay\u0131nlamak i\u00e7in kolay API&#8217;ler sunar. Bu, sohbet uygulamalar\u0131, bildirim sistemleri gibi bir\u00e7ok senaryoda b\u00fcy\u00fck kolayl\u0131k sa\u011flar.<br \/>\n*   <strong>Olay Tabanl\u0131 Mimari:<\/strong> Socket.IO, olay tabanl\u0131 bir yap\u0131ya sahiptir. \u0130stemciler belirli olaylar\u0131 dinleyebilir ve sunucular belirli olaylar\u0131 yayabilir. Bu, kodunuzu daha mod\u00fcler ve y\u00f6netilebilir hale getirir.<br \/>\n*   <strong>Hata Y\u00f6netimi:<\/strong> Ba\u011flant\u0131 hatalar\u0131 ve di\u011fer sorunlar i\u00e7in yerle\u015fik hata y\u00f6netimi mekanizmalar\u0131 sunar.<\/p>\n<p>\u00d6zetle, Socket.IO, WebSocket&#8217;in g\u00fcc\u00fcn\u00fc ve esnekli\u011fini al\u0131rken, ger\u00e7ek d\u00fcnya da\u011f\u0131t\u0131m senaryolar\u0131nda ortaya \u00e7\u0131kabilecek zorluklar\u0131 soyutlayarak geli\u015ftiricilere daha sorunsuz bir deneyim sunar.<\/p>\n<h2>Proje Ortam\u0131n\u0131n Haz\u0131rlanmas\u0131<\/h2>\n<p>Ger\u00e7ek zamanl\u0131 uygulamam\u0131z\u0131 geli\u015ftirmeye ba\u015flamadan \u00f6nce, gerekli ara\u00e7lar\u0131 kurmal\u0131 ve projemizin temel klas\u00f6r yap\u0131s\u0131n\u0131 olu\u015fturmal\u0131y\u0131z. Bu ad\u0131mlar, geli\u015ftirme s\u00fcrecimizin sorunsuz ilerlemesini sa\u011flayacakt\u0131r.<\/p>\n<h3>\u00d6n Ko\u015fullar<\/h3>\n<p>Bu rehberi takip etmek i\u00e7in a\u015fa\u011f\u0131daki yaz\u0131l\u0131mlar\u0131n sisteminizde kurulu olmas\u0131 gerekmektedir:<\/p>\n<p>1.  <strong>Node.js ve npm (Node Package Manager):<\/strong> Node.js, backend&#8217;imizi \u00e7al\u0131\u015ft\u0131rmak i\u00e7in gereklidir. npm ise Node.js paketlerini y\u00f6netmek i\u00e7in kullan\u0131l\u0131r. Node.js&#8217;in resmi web sitesinden (nodejs.org) en son LTS (Uzun S\u00fcreli Destek) s\u00fcr\u00fcm\u00fcn\u00fc indirebilirsiniz. Kurulumdan sonra terminalinizde <code>node -v<\/code> ve <code>npm -v<\/code> komutlar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rarak do\u011fru \u015fekilde kurulup kurulmad\u0131\u011f\u0131n\u0131 kontrol edebilirsiniz.<br \/>\n2.  <strong>Angular CLI (Command Line Interface):<\/strong> Angular projeleri olu\u015fturmak, geli\u015ftirmek ve derlemek i\u00e7in kullan\u0131lan bir komut sat\u0131r\u0131 arac\u0131d\u0131r. <code>npm install -g @angular\/cli<\/code> komutu ile global olarak kurabilirsiniz. Kurulumdan sonra <code>ng v<\/code> komutu ile s\u00fcr\u00fcm\u00fcn\u00fc kontrol edebilirsiniz.<br \/>\n3.  <strong>Bir Kod D\u00fczenleyici\/IDE:<\/strong> Visual Studio Code (VS Code) gibi modern bir kod d\u00fczenleyici, intellisense, hata ay\u0131klama ve Git entegrasyonu gibi \u00f6zelliklerle geli\u015ftirme s\u00fcrecinizi b\u00fcy\u00fck \u00f6l\u00e7\u00fcde kolayla\u015ft\u0131racakt\u0131r.<\/p>\n<h3>Klas\u00f6r Yap\u0131s\u0131 ve Temel Kurulum<\/h3>\n<p>Projemizi d\u00fczenli tutmak i\u00e7in backend ve frontend kodlar\u0131n\u0131 ayr\u0131 klas\u00f6rlerde bar\u0131nd\u0131raca\u011f\u0131z. Ana projemiz i\u00e7in <code>realtime-app<\/code> ad\u0131nda bir klas\u00f6r olu\u015ftural\u0131m.<\/p>\n<pre><code class=\"language-bash\">mkdir realtime-app\ncd realtime-app<\/code><\/pre>\n<p>\u015eimdi bu ana klas\u00f6r\u00fcn i\u00e7ine <code>backend<\/code> ve <code>frontend<\/code> ad\u0131nda iki alt klas\u00f6r olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-bash\">mkdir backend\nmkdir frontend<\/code><\/pre>\n<p>Bu yap\u0131, iki ayr\u0131 uygulaman\u0131n ba\u011f\u0131ms\u0131z olarak geli\u015ftirilmesini ve y\u00f6netilmesini sa\u011flar.<\/p>\n<h3>Node.js Backend Geli\u015ftirme (Socket.IO Sunucusu)<\/h3>\n<p>\u015eimdi projemizin Node.js taraf\u0131n\u0131, yani Socket.IO sunucusunu geli\u015ftirmeye ba\u015flayabiliriz. Bu k\u0131s\u0131m, istemcilerden gelen ba\u011flant\u0131lar\u0131 y\u00f6netecek, olaylar\u0131 dinleyecek ve istemcilere veri yay\u0131nlayacakt\u0131r.<\/p>\n<h3>Node.js Projesinin Olu\u015fturulmas\u0131<\/h3>\n<p>\u0130lk olarak, <code>backend<\/code> klas\u00f6r\u00fcne ge\u00e7elim ve yeni bir Node.js projesi ba\u015flatal\u0131m:<\/p>\n<pre><code class=\"language-bash\">cd backend\nnpm init -y<\/code><\/pre>\n<p>Bu komut, varsay\u0131lan ayarlarla bir <code>package.json<\/code> dosyas\u0131 olu\u015fturacakt\u0131r. \u015eimdi gerekli ba\u011f\u0131ml\u0131l\u0131klar\u0131 kural\u0131m:<\/p>\n<pre><code class=\"language-bash\">npm install express socket.io cors<\/code><\/pre>\n<p>*   <strong>express:<\/strong> HTTP sunucumuzu olu\u015fturmak i\u00e7in kullanaca\u011f\u0131m\u0131z pop\u00fcler bir Node.js web \u00e7er\u00e7evesidir.<br \/>\n*   <strong>socket.io:<\/strong> Ger\u00e7ek zamanl\u0131 ileti\u015fim i\u00e7in Socket.IO sunucu k\u00fct\u00fcphanesidir.<br \/>\n*   <strong>cors:<\/strong> Farkl\u0131 k\u00f6kenlerden (domain) gelen istekleri kabul etmek i\u00e7in Cross-Origin Resource Sharing (CORS) middleware&#8217;idir. Angular uygulamam\u0131z farkl\u0131 bir portta \u00e7al\u0131\u015faca\u011f\u0131 i\u00e7in bu gereklidir.<\/p>\n<h3>Temel Sunucu Kurulumu (<code>index.js<\/code> veya <code>app.js<\/code>)<\/h3>\n<p><code>backend<\/code> klas\u00f6r\u00fcnde <code>index.js<\/code> ad\u0131nda yeni bir dosya olu\u015ftural\u0131m ve temel sunucu kurulumunu yapal\u0131m:<\/p>\n<pre><code class=\"language-javascript\">\/\/ backend\/index.js\n\nconst express = require('express');\nconst http = require('http');\nconst socketIo = require('socket.io');\nconst cors = require('cors');\n\nconst app = express();\nconst server = http.createServer(app); \/\/ Express uygulamas\u0131n\u0131 bir HTTP sunucusuna ba\u011fla\n\n\/\/ CORS ayarlar\u0131: Angular frontend'imizin localhost:4200'den ba\u011flanmas\u0131na izin ver\nconst io = socketIo(server, {\n  cors: {\n    origin: \"http:\/\/localhost:4200\", \/\/ Angular uygulamas\u0131n\u0131n adresi\n    methods: [\"GET\", \"POST\"]\n  }\n});\n\nconst PORT = process.env.PORT || 3000;\n\napp.use(cors()); \/\/ Express i\u00e7in CORS middleware'ini etkinle\u015ftir\n\n\/\/ Basit bir HTTP GET iste\u011fi i\u00e7in rota (iste\u011fe ba\u011fl\u0131, Socket.IO i\u00e7in gerekli de\u011fil)\napp.get('\/', (req, res) => {\n  res.send('Socket.IO sunucusu \u00e7al\u0131\u015f\u0131yor!');\n});\n\n\/\/ Socket.IO ba\u011flant\u0131 olaylar\u0131n\u0131 dinle\nio.on('connection', (socket) => {\n  console.log('Yeni bir kullan\u0131c\u0131 ba\u011fland\u0131:', socket.id);\n\n  \/\/ \u0130stemciden 'sendMessage' olay\u0131n\u0131 dinle\n  socket.on('sendMessage', (message) => {\n    console.log('Mesaj al\u0131nd\u0131:', message);\n    \/\/ Gelen mesaj\u0131 t\u00fcm ba\u011fl\u0131 istemcilere geri g\u00f6nder\n    io.emit('message', {\n      text: message.text,\n      user: message.user,\n      id: socket.id,\n      timestamp: new Date().toLocaleTimeString()\n    });\n  });\n\n  \/\/ Kullan\u0131c\u0131 ayr\u0131ld\u0131\u011f\u0131nda\n  socket.on('disconnect', () => {\n    console.log('Bir kullan\u0131c\u0131 ayr\u0131ld\u0131:', socket.id);\n  });\n});\n\nserver.listen(PORT, () => {\n  console.log(<code>Sunucu http:\/\/localhost:${PORT} adresinde \u00e7al\u0131\u015f\u0131yor<\/code>);\n});<\/code><\/pre>\n<p>Bu kod par\u00e7as\u0131 \u015funlar\u0131 yapar:<br \/>\n1.  <strong>Gerekli Mod\u00fclleri Y\u00fckler:<\/strong> <code>express<\/code>, <code>http<\/code>, <code>socket.io<\/code> ve <code>cors<\/code>.<br \/>\n2.  <strong>Express Uygulamas\u0131 Olu\u015fturur:<\/strong> <code>app = express()<\/code>.<br \/>\n3.  <strong>HTTP Sunucusu Olu\u015fturur:<\/strong> <code>http.createServer(app)<\/code> ile Express uygulamas\u0131n\u0131 sarmalar. Socket.IO&#8217;nun bir HTTP sunucusu \u00fczerinde \u00e7al\u0131\u015fmas\u0131 gerekir.<br \/>\n4.  <strong>Socket.IO Sunucusunu Ba\u015flat\u0131r:<\/strong> <code>socketIo(server, {...})<\/code> ile HTTP sunucusunu Socket.IO&#8217;ya ba\u011flar. <strong>CORS ayarlar\u0131<\/strong> burada \u00e7ok \u00f6nemlidir. Angular uygulamam\u0131z farkl\u0131 bir portta (genellikle 4200) \u00e7al\u0131\u015faca\u011f\u0131 i\u00e7in, Socket.IO sunucumuzun bu adresten gelen ba\u011flant\u0131lara izin vermesi gerekir.<br \/>\n5.  <strong>CORS Middleware&#8217;i:<\/strong> <code>app.use(cors())<\/code> ile Express HTTP rotalar\u0131 i\u00e7in de CORS&#8217;u etkinle\u015ftirir.<br \/>\n6.  <strong>Socket.IO Ba\u011flant\u0131 Olay\u0131:<\/strong> <code>io.on('connection', (socket) => { ... })<\/code> yeni bir istemci sunucuya ba\u011fland\u0131\u011f\u0131nda tetiklenir. Her ba\u011fl\u0131 istemci i\u00e7in benzersiz bir <code>socket<\/code> nesnesi olu\u015fturulur.<br \/>\n7.  <strong><code>sendMessage<\/code> Olay\u0131:<\/strong> Bir istemci <code>sendMessage<\/code> ad\u0131nda bir olay g\u00f6nderdi\u011finde, sunucu bu olay\u0131 yakalar.<br \/>\n8.  <strong><code>io.emit('message', ...)<\/code>:<\/strong> Sunucu, ald\u0131\u011f\u0131 mesaj\u0131 <code>message<\/code> olay\u0131yla <strong>t\u00fcm ba\u011fl\u0131 istemcilere<\/strong> geri yay\u0131nlar. Bu, bir chat uygulamas\u0131n\u0131n temelini olu\u015fturur.<br \/>\n9.  <strong><code>disconnect<\/code> Olay\u0131:<\/strong> Bir istemci ba\u011flant\u0131s\u0131 kesildi\u011finde tetiklenir.<br \/>\n10. <strong>Sunucuyu Dinlemeye Ba\u015flar:<\/strong> <code>server.listen(PORT, ...)<\/code> ile sunucuyu belirli bir portta (varsay\u0131lan olarak 3000) dinlemeye ba\u015flar.<\/p>\n<h3>Socket.IO Olaylar\u0131n\u0131 Y\u00f6netme<\/h3>\n<p>Yukar\u0131daki \u00f6rnekte temel olay y\u00f6netimini g\u00f6rd\u00fck (<code>connection<\/code>, <code>disconnect<\/code>, <code>sendMessage<\/code>). Socket.IO, farkl\u0131 yay\u0131nlama y\u00f6ntemleri sunarak ileti\u015fimi daha esnek hale getirir:<\/p>\n<p>*   <strong><code>socket.emit('event', data)<\/code>:<\/strong> Sadece olay\u0131 tetikleyen istemciye veri g\u00f6nderir.<br \/>\n*   <strong><code>io.emit('event', data)<\/code>:<\/strong> T\u00fcm ba\u011fl\u0131 istemcilere veri g\u00f6nderir. (Yukar\u0131daki chat \u00f6rne\u011finde kullan\u0131ld\u0131)<br \/>\n*   <strong><code>socket.broadcast.emit('event', data)<\/code>:<\/strong> Olay\u0131 tetikleyen istemci hari\u00e7, t\u00fcm di\u011fer ba\u011fl\u0131 istemcilere veri g\u00f6nderir.<br \/>\n*   <strong><code>io.to('roomName').emit('event', data)<\/code>:<\/strong> Belirli bir odaya kat\u0131lm\u0131\u015f t\u00fcm istemcilere veri g\u00f6nderir. (\u0130leri seviye konularda detayland\u0131r\u0131lacak)<br \/>\n*   <strong><code>socket.join('roomName')<\/code> \/ <code>socket.leave('roomName')<\/code>:<\/strong> Bir istemciyi bir odaya dahil etmek veya odadan \u00e7\u0131karmak i\u00e7in kullan\u0131l\u0131r.<\/p>\n<p>\u015eimdilik chat uygulamam\u0131z i\u00e7in <code>io.emit()<\/code> kullan\u0131m\u0131 yeterlidir. Backend&#8217;imiz haz\u0131r!<\/p>\n<h3>Angular Frontend Geli\u015ftirme (Socket.IO \u0130stemcisi)<\/h3>\n<p>\u015eimdi s\u0131ra Angular taraf\u0131nda, yani Socket.IO istemcisini geli\u015ftirmeye geldi. Bu k\u0131s\u0131m, kullan\u0131c\u0131 aray\u00fcz\u00fcn\u00fc olu\u015fturacak, Socket.IO sunucusuna ba\u011flanacak ve olaylar\u0131 dinleyip g\u00f6nderecektir.<\/p>\n<h3>Angular Projesinin Olu\u015fturulmas\u0131<\/h3>\n<p><code>frontend<\/code> klas\u00f6r\u00fcne ge\u00e7elim ve yeni bir Angular projesi olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-bash\">cd ..\/frontend # E\u011fer backend klas\u00f6r\u00fcndeyseniz, bir \u00fcst dizine \u00e7\u0131k\u0131p frontend'e girin\nng new frontend-app --skip-git --style=scss --routing=false\ncd frontend-app<\/code><\/pre>\n<p>*   <code>--skip-git<\/code>: Git deposu olu\u015fturmay\u0131 atlar (iste\u011fe ba\u011fl\u0131).<br \/>\n*   <code>--style=scss<\/code>: CSS \u00f6n i\u015flemcisi olarak SCSS kullan\u0131r (iste\u011fe ba\u011fl\u0131).<br \/>\n*   <code>--routing=false<\/code>: Ba\u015flang\u0131\u00e7ta routing mod\u00fcl\u00fc olu\u015fturmaz (basit bir uygulama i\u00e7in gerek yok).<\/p>\n<h3>Socket.IO \u0130stemci K\u00fct\u00fcphanesinin Kurulumu<\/h3>\n<p>Angular projemizin i\u00e7ine Socket.IO istemci k\u00fct\u00fcphanesini kural\u0131m:<\/p>\n<pre><code class=\"language-bash\">npm install socket.io-client<\/code><\/pre>\n<h3>Socket.IO Servisi Olu\u015fturma<\/h3>\n<p>Ger\u00e7ek zamanl\u0131 ileti\u015fimi y\u00f6netmek i\u00e7in bir Angular servisi olu\u015ftural\u0131m. Bu servis, Socket.IO ba\u011flant\u0131s\u0131n\u0131 kuracak, olaylar\u0131 dinleyecek ve g\u00f6nderecek.<\/p>\n<pre><code class=\"language-bash\">ng generate service services\/socket<\/code><\/pre>\n<p>\u015eimdi <code>src\/app\/services\/socket.service.ts<\/code> dosyas\u0131n\u0131 a\u00e7al\u0131m ve i\u00e7eri\u011fini g\u00fcncelleyelim:<\/p>\n<pre><code class=\"language-typescript\">\/\/ frontend\/frontend-app\/src\/app\/services\/socket.service.ts\n\nimport { Injectable } from '@angular\/core';\nimport { io, Socket } from 'socket.io-client';\nimport { Observable } from 'rxjs';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class SocketService {\n  private socket: Socket;\n  private readonly serverUrl = 'http:\/\/localhost:3000'; \/\/ Node.js sunucumuzun adresi\n\n  constructor() {\n    this.socket = io(this.serverUrl); \/\/ Socket.IO sunucusuna ba\u011flan\n  }\n\n  \/\/ Sunucuya mesaj g\u00f6nderme\n  sendMessage(message: { text: string, user: string }): void {\n    this.socket.emit('sendMessage', message);\n  }\n\n  \/\/ Sunucudan gelen 'message' olay\u0131n\u0131 dinleme\n  onMessage(): Observable<any> {\n    return new Observable(observer => {\n      this.socket.on('message', (data: any) => {\n        observer.next(data);\n      });\n    });\n  }\n\n  \/\/ Ba\u011flant\u0131 durumunu izleme (iste\u011fe ba\u011fl\u0131)\n  onConnect(): Observable<string> {\n    return new Observable(observer => {\n      this.socket.on('connect', () => {\n        observer.next('Ba\u011fland\u0131');\n      });\n    });\n  }\n\n  onDisconnect(): Observable<string> {\n    return new Observable(observer => {\n      this.socket.on('disconnect', () => {\n        observer.next('Ba\u011flant\u0131 kesildi');\n      });\n    });\n  }\n\n  \/\/ Daha fazla olay dinleyici veya yay\u0131c\u0131 eklenebilir\n}<\/code><\/pre>\n<p>Bu servis \u015funlar\u0131 yapar:<br \/>\n1.  <code>socket.io-client<\/code> k\u00fct\u00fcphanesinden <code>io<\/code> ve <code>Socket<\/code> nesnelerini import eder.<br \/>\n2.  <code>serverUrl<\/code> de\u011fi\u015fkeninde Node.js sunucumuzun adresini tutar.<br \/>\n3.  Constructor i\u00e7inde <code>io(this.serverUrl)<\/code> ile Socket.IO sunucusuna ba\u011flant\u0131 kurar.<br \/>\n4.  <code>sendMessage<\/code> metodu ile sunucuya <code>sendMessage<\/code> olay\u0131n\u0131 ve mesaj verisini g\u00f6nderir.<br \/>\n5.  <code>onMessage<\/code> metodu, sunucudan gelen <code>message<\/code> olaylar\u0131n\u0131 bir <code>Observable<\/code> olarak d\u00f6nd\u00fcr\u00fcr. Bu sayede bile\u015fenler bu <code>Observable<\/code>&#8216;a abone olarak ger\u00e7ek zamanl\u0131 mesajlar\u0131 alabilirler.<br \/>\n6.  <code>onConnect<\/code> ve <code>onDisconnect<\/code> gibi metotlar, ba\u011flant\u0131 durumunu izlemek i\u00e7in eklenebilir.<\/p>\n<h3>Bile\u015fenlerin Geli\u015ftirilmesi (\u00d6rnek: Chat Bile\u015feni)<\/h3>\n<p>\u015eimdi bir chat bile\u015feni olu\u015ftural\u0131m ve bu bile\u015fende <code>SocketService<\/code>&#8216;i kullanarak mesaj g\u00f6nderip alal\u0131m.<\/p>\n<pre><code class=\"language-bash\">ng generate component components\/chat<\/code><\/pre>\n<p>\u015eimdi <code>src\/app\/components\/chat\/chat.component.ts<\/code> dosyas\u0131n\u0131 a\u00e7al\u0131m:<\/p>\n<pre><code class=\"language-typescript\">\/\/ frontend\/frontend-app\/src\/app\/components\/chat\/chat.component.ts\n\nimport { Component, OnInit, OnDestroy } from '@angular\/core';\nimport { SocketService } from '..\/..\/services\/socket.service';\nimport { Subscription } from 'rxjs';\n\ninterface Message {\n  text: string;\n  user: string;\n  id: string; \/\/ Socket ID\n  timestamp: string;\n}\n\n@Component({\n  selector: 'app-chat',\n  templateUrl: '.\/chat.component.html',\n  styleUrls: ['.\/chat.component.scss']\n})\nexport class ChatComponent implements OnInit, OnDestroy {\n  messageText: string = '';\n  userName: string = 'Kullan\u0131c\u0131' + Math.floor(Math.random() * 100); \/\/ Rastgele kullan\u0131c\u0131 ad\u0131\n  messages: Message[] = [];\n  private messageSubscription: Subscription | undefined;\n\n  constructor(private socketService: SocketService) { }\n\n  ngOnInit(): void {\n    \/\/ Mesajlar\u0131 dinlemeye ba\u015fla\n    this.messageSubscription = this.socketService.onMessage().subscribe((message: Message) => {\n      this.messages.push(message);\n    });\n\n    \/\/ Ba\u011flant\u0131 durumunu da dinleyebiliriz (iste\u011fe ba\u011fl\u0131)\n    this.socketService.onConnect().subscribe(status => console.log('Socket durumu:', status));\n    this.socketService.onDisconnect().subscribe(status => console.log('Socket durumu:', status));\n  }\n\n  sendMessage(): void {\n    if (this.messageText.trim()) {\n      const message = {\n        text: this.messageText,\n        user: this.userName\n      };\n      this.socketService.sendMessage(message);\n      this.messageText = ''; \/\/ Mesaj g\u00f6nderildikten sonra inputu temizle\n    }\n  }\n\n  ngOnDestroy(): void {\n    \/\/ Bile\u015fen yok edildi\u011finde aboneli\u011fi iptal et\n    if (this.messageSubscription) {\n      this.messageSubscription.unsubscribe();\n    }\n  }\n}<\/code><\/pre>\n<p>Ve <code>src\/app\/components\/chat\/chat.component.html<\/code> dosyas\u0131n\u0131 g\u00fcncelleyelim:<\/p>\n<pre><code class=\"language-html\"><!-- frontend\/frontend-app\/src\/app\/components\/chat\/chat.component.html -->\n\n<div class=\"chat-container\">\n  <h2>Socket.IO Chat Uygulamas\u0131<\/h2>\n  <div class=\"messages\">\n    <div *ngFor=\"let msg of messages\" class=\"message-item\">\n      <span class=\"timestamp\">[{{ msg.timestamp }}]<\/span>\n      <span class=\"user\" [class.me]=\"msg.user === userName\">{{ msg.user }}:<\/span>\n      <span class=\"text\">{{ msg.text }}<\/span>\n    <\/div>\n  <\/div>\n  <div class=\"input-area\">\n    <input type=\"text\" [(ngModel)]=\"userName\" placeholder=\"Kullan\u0131c\u0131 Ad\u0131n\u0131z\" class=\"username-input\">\n    <input type=\"text\" [(ngModel)]=\"messageText\" (keyup.enter)=\"sendMessage()\" placeholder=\"Mesaj\u0131n\u0131z\u0131 yaz\u0131n...\" class=\"message-input\">\n    <button (click)=\"sendMessage()\" [disabled]=\"!messageText.trim()\">G\u00f6nder<\/button>\n  <\/div>\n<\/div><\/code><\/pre>\n<p>Son olarak, <code>src\/app\/components\/chat\/chat.component.scss<\/code> dosyas\u0131na basit stil ekleyelim:<\/p>\n<pre><code class=\"language-scss\">\/<em> frontend\/frontend-app\/src\/app\/components\/chat\/chat.component.scss <\/em>\/\n\n.chat-container {\n  max-width: 600px;\n  margin: 50px auto;\n  border: 1px solid #ccc;\n  border-radius: 8px;\n  padding: 20px;\n  box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n  font-family: Arial, sans-serif;\n\n  h2 {\n    text-align: center;\n    color: #333;\n    margin-bottom: 20px;\n  }\n\n  .messages {\n    height: 300px;\n    overflow-y: auto;\n    border: 1px solid #eee;\n    padding: 10px;\n    margin-bottom: 15px;\n    background-color: #f9f9f9;\n    border-radius: 4px;\n  }\n\n  .message-item {\n    margin-bottom: 8px;\n    .timestamp {\n      color: #888;\n      font-size: 0.8em;\n      margin-right: 5px;\n    }\n    .user {\n      font-weight: bold;\n      color: #007bff;\n    }\n    .user.me {\n      color: #28a745;\n    }\n    .text {\n      color: #333;\n    }\n  }\n\n  .input-area {\n    display: flex;\n    gap: 10px;\n\n    .username-input,\n    .message-input {\n      flex: 1;\n      padding: 10px;\n      border: 1px solid #ddd;\n      border-radius: 4px;\n    }\n\n    .username-input {\n      flex: 0.5;\n    }\n\n    button {\n      padding: 10px 15px;\n      background-color: #007bff;\n      color: white;\n      border: none;\n      border-radius: 4px;\n      cursor: pointer;\n      &:hover:not(:disabled) {\n        background-color: #0056b3;\n      }\n      &:disabled {\n        background-color: #cccccc;\n        cursor: not-allowed;\n      }\n    }\n  }\n}<\/code><\/pre>\n<p>Son olarak, <code>src\/app\/app.module.ts<\/code> dosyas\u0131na <code>FormsModule<\/code>&#8216;u ve <code>ChatComponent<\/code>&#8216;i eklememiz gerekiyor:<\/p>\n<pre><code class=\"language-typescript\">\/\/ frontend\/frontend-app\/src\/app\/app.module.ts\n\nimport { NgModule } from '@angular\/core';\nimport { BrowserModule } from '@angular\/platform-browser';\nimport { FormsModule } from '@angular\/forms'; \/\/ FormsModule'u import et\n\nimport { AppComponent } from '.\/app.component';\nimport { ChatComponent } from '.\/components\/chat\/chat.component'; \/\/ ChatComponent'i import et\n\n@NgModule({\n  declarations: [\n    AppComponent,\n    ChatComponent \/\/ ChatComponent'i declarations dizisine ekle\n  ],\n  imports: [\n    BrowserModule,\n    FormsModule \/\/ FormsModule'u imports dizisine ekle\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }<\/code><\/pre>\n<p>Ve <code>src\/app\/app.component.html<\/code> dosyas\u0131n\u0131 da g\u00fcncelleyelim, b\u00f6ylece <code>ChatComponent<\/code> ana uygulamam\u0131zda g\u00f6r\u00fcnt\u00fclenir:<\/p>\n<pre><code class=\"language-html\"><!-- frontend\/frontend-app\/src\/app\/app.component.html -->\n\n<app-chat><\/app-chat><\/code><\/pre>\n<h3>CORS Politikalar\u0131 ve Proxy Yap\u0131land\u0131rmas\u0131 (Geli\u015ftirme Ortam\u0131 \u0130\u00e7in)<\/h3>\n<p>Geli\u015ftirme ortam\u0131nda Angular uygulamas\u0131 genellikle <code>localhost:4200<\/code> adresinde \u00e7al\u0131\u015f\u0131rken, Node.js sunucusu <code>localhost:3000<\/code> adresinde \u00e7al\u0131\u015f\u0131r. Bu, farkl\u0131 k\u00f6kenler (origin) anlam\u0131na gelir ve taray\u0131c\u0131lar g\u00fcvenlik nedeniyle bu t\u00fcr \u00e7apraz k\u00f6ken isteklerini varsay\u0131lan olarak engeller (CORS politikas\u0131).<\/p>\n<p>Backend taraf\u0131nda Socket.IO sunucusunu ba\u015flat\u0131rken CORS ayarlar\u0131n\u0131 yapt\u0131k: <code>origin: \"http:\/\/localhost:4200\"<\/code>. Bu, Socket.IO ba\u011flant\u0131lar\u0131 i\u00e7in yeterlidir. Ancak, e\u011fer Angular uygulaman\u0131zdan Express backend&#8217;ine do\u011frudan HTTP istekleri (\u00f6rne\u011fin bir REST API) g\u00f6ndermek isterseniz, Express taraf\u0131nda da <code>app.use(cors())<\/code> kullanman\u0131z gerekir.<\/p>\n<p>Angular geli\u015ftirme sunucusunun (ng serve) proxy \u00f6zelli\u011fini kullanarak da bu sorunu a\u015fabilirsiniz. Bu, \u00f6zellikle REST API&#8217;leri i\u00e7in kullan\u0131\u015fl\u0131d\u0131r:<br \/>\n1.  <code>frontend-app<\/code> klas\u00f6r\u00fcnde <code>proxy.conf.json<\/code> ad\u0131nda bir dosya olu\u015fturun:<\/p>\n<pre><code class=\"language-json\">\/\/ frontend\/frontend-app\/proxy.conf.json\n    {\n      \"\/api\": {\n        \"target\": \"http:\/\/localhost:3000\",\n        \"secure\": false,\n        \"changeOrigin\": true\n      }\n    }<\/code><\/pre>\n<p>2.  <code>angular.json<\/code> dosyan\u0131zda <code>serve<\/code> konfig\u00fcrasyonunu g\u00fcncelleyin:<\/p>\n<pre><code class=\"language-json\">\/\/ angular.json (ilgili k\u0131s\u0131m)\n    \"architect\": {\n      \"serve\": {\n        \"builder\": \"@angular-devkit\/build-angular:dev-server\",\n        \"options\": {\n          \"browserTarget\": \"frontend-app:build\",\n          \"proxyConfig\": \"proxy.conf.json\" \/\/ Bu sat\u0131r\u0131 ekle\n        },\n        \/\/ ...\n      }\n    }<\/code><\/pre>\n<p>3.  Angular uygulamas\u0131n\u0131 ba\u015flat\u0131rken <code>ng serve<\/code> yerine <code>ng serve --proxy-config proxy.conf.json<\/code> veya <code>angular.json<\/code>&#8216;a eklediyseniz sadece <code>ng serve<\/code> kullanabilirsiniz.<br \/>\nBu yap\u0131land\u0131rma ile Angular uygulaman\u0131z <code>\/api<\/code> ile ba\u015flayan t\u00fcm istekleri <code>http:\/\/localhost:3000<\/code> adresine y\u00f6nlendirecektir. Socket.IO i\u00e7in bu do\u011frudan gerekli olmasa da, karma\u015f\u0131k uygulamalarda s\u0131k\u00e7a kullan\u0131l\u0131r.<\/p>\n<h3>Uygulamay\u0131 \u00c7al\u0131\u015ft\u0131rma ve Test Etme<\/h3>\n<p>\u015eimdi hem backend hem de frontend uygulamam\u0131z\u0131 \u00e7al\u0131\u015ft\u0131rarak ger\u00e7ek zamanl\u0131 sohbet uygulamas\u0131n\u0131 test edebiliriz.<\/p>\n<h3>Backend&#8217;i Ba\u015flatma<\/h3>\n<p>Terminalinizde <code>backend<\/code> klas\u00f6r\u00fcne gidin ve Node.js sunucusunu ba\u015flat\u0131n:<\/p>\n<pre><code class=\"language-bash\">cd realtime-app\/backend\nnode index.js<\/code><\/pre>\n<p>Ba\u015far\u0131l\u0131 olursa, &#8220;Sunucu http:\/\/localhost:3000 adresinde \u00e7al\u0131\u015f\u0131yor&#8221; mesaj\u0131n\u0131 g\u00f6rmelisiniz. Bu terminal penceresini a\u00e7\u0131k b\u0131rak\u0131n.<\/p>\n<h3>Frontend&#8217;i Ba\u015flatma<\/h3>\n<p>Yeni bir terminal penceresi a\u00e7\u0131n, <code>frontend\/frontend-app<\/code> klas\u00f6r\u00fcne gidin ve Angular uygulamas\u0131n\u0131 ba\u015flat\u0131n:<\/p>\n<pre><code class=\"language-bash\">cd realtime-app\/frontend\/frontend-app\nng serve --open<\/code><\/pre>\n<p><code>--open<\/code> bayra\u011f\u0131, uygulaman\u0131z\u0131n taray\u0131c\u0131da otomatik olarak <code>http:\/\/localhost:4200<\/code> adresinde a\u00e7\u0131lmas\u0131n\u0131 sa\u011flar.<\/p>\n<h3>Taray\u0131c\u0131da Test Etme<\/h3>\n<p>1.  Taray\u0131c\u0131n\u0131zda <code>http:\/\/localhost:4200<\/code> adresine gidin. Sohbet uygulamas\u0131n\u0131n aray\u00fcz\u00fcn\u00fc g\u00f6rmelisiniz.<br \/>\n2.  Yeni bir taray\u0131c\u0131 sekmesi veya penceresi a\u00e7\u0131n ve yine <code>http:\/\/localhost:4200<\/code> adresine gidin.<br \/>\n3.  Her iki sekmede de farkl\u0131 kullan\u0131c\u0131 adlar\u0131 girin (veya varsay\u0131lan rastgele adlar\u0131 kullan\u0131n).<br \/>\n4.  Bir sekmede bir mesaj yaz\u0131n ve g\u00f6nderin. Mesaj\u0131n an\u0131nda di\u011fer sekmede de belirdi\u011fini g\u00f6rmelisiniz.<\/p>\n<p>Bu, Socket.IO&#8217;nun ger\u00e7ek zamanl\u0131 ileti\u015fim yetene\u011fini ve Node.js backend ile Angular frontend aras\u0131ndaki sorunsuz entegrasyonu ba\u015far\u0131yla g\u00f6sterir. Backend terminalinizde yeni ba\u011flant\u0131lar\u0131 ve al\u0131nan mesajlar\u0131 da g\u00f6rebilirsiniz.<\/p>\n<h3>\u0130leri Seviye Konular ve Optimizasyonlar<\/h3>\n<p>Basit bir sohbet uygulamas\u0131 olu\u015fturmu\u015f olsak da, ger\u00e7ek d\u00fcnya senaryolar\u0131nda daha karma\u015f\u0131k ihtiya\u00e7lar ve performans optimizasyonlar\u0131 gerekebilir. \u0130\u015fte baz\u0131 ileri seviye konular:<\/p>\n<h3>Odalar (Rooms) Kullan\u0131m\u0131<\/h3>\n<p>Socket.IO&#8217;nun en g\u00fc\u00e7l\u00fc \u00f6zelliklerinden biri &#8220;odalar&#8221;d\u0131r. Odalar, belirli bir grup istemciye mesaj g\u00f6ndermek i\u00e7in kullan\u0131l\u0131r. \u00d6rne\u011fin, farkl\u0131 sohbet kanallar\u0131, oyun lobileri veya belirli bir belge \u00fczerinde \u00e7al\u0131\u015fan kullan\u0131c\u0131 gruplar\u0131 olu\u015fturabilirsiniz.<\/p>\n<p><strong>Backend&#8217;de:<\/strong><br \/>\nBir istemciyi bir odaya dahil etmek i\u00e7in:<\/p>\n<pre><code class=\"language-javascript\">socket.on('joinRoom', (roomName) => {\n  socket.join(roomName);\n  console.log(<code>${socket.id} kullan\u0131c\u0131s\u0131 ${roomName} odas\u0131na kat\u0131ld\u0131.<\/code>);\n  \/\/ Odaya kat\u0131lan kullan\u0131c\u0131ya veya odaya \u00f6zel mesaj g\u00f6nderebilirsiniz\n  socket.emit('roomJoined', <code>Odaya ba\u015far\u0131yla kat\u0131ld\u0131n\u0131z: ${roomName}<\/code>);\n  io.to(roomName).emit('notification', <code>${socket.id} odaya kat\u0131ld\u0131.<\/code>);\n});\n\nsocket.on('sendRoomMessage', (data) => {\n  io.to(data.roomName).emit('roomMessage', {\n    text: data.message,\n    user: data.user,\n    room: data.roomName\n  });\n});<\/code><\/pre>\n<p><strong>Frontend&#8217;de:<\/strong><\/p>\n<pre><code class=\"language-typescript\">\/\/ SocketService i\u00e7inde\njoinRoom(roomName: string): void {\n  this.socket.emit('joinRoom', roomName);\n}\n\nonRoomMessage(): Observable<any> {\n  return new Observable(observer => {\n    this.socket.on('roomMessage', (data: any) => {\n      observer.next(data);\n    });\n  });\n}\n\n\/\/ Chat bile\u015feninde\njoinSpecificRoom(room: string) {\n  this.socketService.joinRoom(room);\n  \/\/ Daha sonra bu odan\u0131n mesajlar\u0131n\u0131 dinlemeye ba\u015flay\u0131n\n}<\/code><\/pre>\n<h3>Kimlik Do\u011frulama ve Yetkilendirme<\/h3>\n<p>Ger\u00e7ek zamanl\u0131 uygulamalarda genellikle kullan\u0131c\u0131lar\u0131n kimli\u011fini do\u011frulamak ve belirli eylemleri ger\u00e7ekle\u015ftirmek i\u00e7in yetkilerini kontrol etmek istersiniz. JWT (JSON Web Token) en yayg\u0131n y\u00f6ntemlerden biridir.<\/p>\n<p><strong>S\u00fcre\u00e7:<\/strong><br \/>\n1.  Kullan\u0131c\u0131 normal bir HTTP iste\u011fi ile (\u00f6rne\u011fin <code>\/login<\/code> rotas\u0131na) kimlik do\u011frulamas\u0131 yapar.<br \/>\n2.  Sunucu, ba\u015far\u0131l\u0131 kimlik do\u011frulamas\u0131ndan sonra bir JWT olu\u015fturur ve istemciye g\u00f6nderir.<br \/>\n3.  \u0130stemci, Socket.IO ba\u011flant\u0131s\u0131n\u0131 kurarken bu JWT&#8217;yi Socket.IO ba\u011flant\u0131s\u0131n\u0131n <code>extraHeaders<\/code> veya <code>auth<\/code> se\u00e7enekleri arac\u0131l\u0131\u011f\u0131yla g\u00f6nderir.<\/p>\n<pre><code class=\"language-typescript\">\/\/ frontend\/socket.service.ts\n    const token = localStorage.getItem('jwt_token'); \/\/ Veya ba\u015fka bir yerden al\u0131n\n    this.socket = io(this.serverUrl, {\n      auth: {\n        token: token\n      }\n    });<\/code><\/pre>\n<p>4.  Sunucu taraf\u0131nda, Socket.IO ba\u011flant\u0131s\u0131 kurulmadan \u00f6nce bir middleware kullanarak JWT&#8217;yi do\u011frulayabilirsiniz:<\/p>\n<pre><code class=\"language-javascript\">\/\/ backend\/index.js\n    io.use((socket, next) => {\n      const token = socket.handshake.auth.token;\n      if (token) {\n        \/\/ JWT'yi do\u011frula\n        jwt.verify(token, 'YOUR_SECRET_KEY', (err, decoded) => {\n          if (err) return next(new Error('Authentication error'));\n          socket.user = decoded; \/\/ Kullan\u0131c\u0131 bilgilerini socket nesnesine ata\n          next();\n        });\n      } else {\n        next(new Error('Authentication error: Token not provided'));\n      }\n    });<\/code><\/pre>\n<p>    Bu sayede, sadece ge\u00e7erli bir JWT&#8217;ye sahip kullan\u0131c\u0131lar\u0131n Socket.IO ba\u011flant\u0131s\u0131 kurmas\u0131na izin verilir.<\/p>\n<h3>Hata Y\u00f6netimi ve Yeniden Ba\u011flant\u0131<\/h3>\n<p>Socket.IO istemcisi, ba\u011flant\u0131 kesildi\u011finde otomatik olarak yeniden ba\u011flanmaya \u00e7al\u0131\u015f\u0131r. Ancak, bu davran\u0131\u015f\u0131n nas\u0131l y\u00f6netilece\u011fini \u00f6zelle\u015ftirebilirsiniz:<\/p>\n<pre><code class=\"language-typescript\">\/\/ frontend\/socket.service.ts\nthis.socket = io(this.serverUrl, {\n  reconnection: true, \/\/ Varsay\u0131lan olarak true\n  reconnectionAttempts: 5, \/\/ Yeniden ba\u011flant\u0131 deneme say\u0131s\u0131\n  reconnectionDelay: 1000, \/\/ \u0130lk yeniden ba\u011flant\u0131 denemesi gecikmesi (ms)\n  reconnectionDelayMax: 5000 \/\/ Maksimum yeniden ba\u011flant\u0131 gecikmesi (ms)\n});\n\nthis.socket.on('reconnect', (attemptNumber) => {\n  console.log('Yeniden ba\u011fland\u0131:', attemptNumber);\n});\nthis.socket.on('reconnect_error', (error) => {\n  console.error('Yeniden ba\u011flant\u0131 hatas\u0131:', error);\n});<\/code><\/pre>\n<p>Sunucu taraf\u0131nda da <code>error<\/code> olaylar\u0131n\u0131 dinlemek \u00f6nemlidir:<\/p>\n<pre><code class=\"language-javascript\">\/\/ backend\/index.js\nsocket.on('error', (err) => {\n  console.error('Socket hatas\u0131:', err);\n});<\/code><\/pre>\n<h3>\u00d6l\u00e7eklenebilirlik<\/h3>\n<p>Tek bir Node.js sunucusu binlerce e\u015fzamanl\u0131 ba\u011flant\u0131y\u0131 y\u00f6netebilirken, daha b\u00fcy\u00fck uygulamalar i\u00e7in birden fazla sunucuya ihtiyac\u0131n\u0131z olabilir. Bu durumda, Socket.IO&#8217;nun istemcileri farkl\u0131 sunuculara da\u011f\u0131tmas\u0131 ve t\u00fcm sunucular\u0131n ayn\u0131 mesajlar\u0131 yay\u0131nlayabilmesi i\u00e7in bir adapt\u00f6re ihtiyac\u0131n\u0131z vard\u0131r.<\/p>\n<p>*   <strong>Redis Adapt\u00f6r\u00fc:<\/strong> Socket.IO, birden fazla sunucu aras\u0131nda olaylar\u0131 yay\u0131nlamak i\u00e7in Redis adapt\u00f6r\u00fc sa\u011flar. Bu, farkl\u0131 sunuculara ba\u011fl\u0131 istemcilerin bile ayn\u0131 mesajlar\u0131 almas\u0131n\u0131 sa\u011flar.<\/p>\n<pre><code class=\"language-bash\">npm install @socket.io\/redis-adapter redis<\/code><\/pre>\n<pre><code class=\"language-javascript\">\/\/ backend\/index.js (Redis adapt\u00f6r\u00fcn\u00fc kullanmak i\u00e7in)\n    const { createClient } = require(\"redis\");\n    const { createAdapter } = require(\"@socket.io\/redis-adapter\");\n\n    const pubClient = createClient({ url: \"redis:\/\/localhost:6379\" });\n    const subClient = pubClient.duplicate();\n\n    Promise.all([pubClient.connect(), subClient.connect()]).then(() => {\n      io.adapter(createAdapter(pubClient, subClient));\n      \/\/ Sunucu dinlemeye ba\u015fla\n      server.listen(PORT, () => {\n        console.log(<code>Sunucu http:\/\/localhost:${PORT} adresinde \u00e7al\u0131\u015f\u0131yor<\/code>);\n      });\n    }).catch(err => console.error(\"Redis ba\u011flant\u0131 hatas\u0131:\", err));<\/code><\/pre>\n<p>*   <strong>Sticky Sessions:<\/strong> Birden fazla Node.js sunucusu kullan\u0131rken, bir istemcinin her zaman ayn\u0131 sunucuya ba\u011flanmas\u0131n\u0131 sa\u011flamak i\u00e7in bir load balancer \u00fczerinde &#8220;sticky sessions&#8221; (yap\u0131\u015fkan oturumlar) yap\u0131land\u0131rman\u0131z gerekebilir. Bu, her WebSocket ba\u011flant\u0131s\u0131n\u0131n belirli bir sunucuyla ili\u015fkilendirilmesini sa\u011flar.<\/p>\n<h3>Performans \u0130pu\u00e7lar\u0131<\/h3>\n<p>*   <strong>Veri Boyutunu Azalt\u0131n:<\/strong> Yaln\u0131zca gerekli verileri g\u00f6nderin. Gereksiz veya b\u00fcy\u00fck nesneleri g\u00f6ndermek a\u011f trafi\u011fini art\u0131r\u0131r.<br \/>\n*   <strong>Olay S\u0131kl\u0131\u011f\u0131n\u0131 Y\u00f6netin:<\/strong> Fare hareketleri veya tu\u015f vuru\u015flar\u0131 gibi y\u00fcksek frekansl\u0131 olaylar\u0131 g\u00f6nderirken <code>debounce<\/code> veya <code>throttle<\/code> tekniklerini kullan\u0131n. Bu, sunucuya g\u00f6nderilen olay say\u0131s\u0131n\u0131 azalt\u0131r.<br \/>\n*   <strong>Binary Veri Kullan\u0131m\u0131:<\/strong> G\u00f6r\u00fcnt\u00fcler veya ses gibi b\u00fcy\u00fck ikili veriler i\u00e7in Socket.IO&#8217;nun ikili veri deste\u011fini kullan\u0131n.<br \/>\n*   <strong>G\u00fcvenlik:<\/strong> DDoS sald\u0131r\u0131lar\u0131na kar\u015f\u0131 koruma, rate limiting ve veri \u015fifrelemesi gibi g\u00fcvenlik \u00f6nlemlerini uygulay\u0131n.<\/p>\n<h2>Sonu\u00e7<\/h2>\n<p>Bu kapsaml\u0131 rehberde, Node.js, Socket.IO ve Angular kullanarak s\u0131f\u0131rdan bir ger\u00e7ek zamanl\u0131 sohbet uygulamas\u0131 geli\u015ftirmeyi \u00f6\u011frendik. Ger\u00e7ek zamanl\u0131 uygulamalar\u0131n temel prensiplerini, WebSocket protokol\u00fcn\u00fcn \u00f6nemini ve Socket.IO&#8217;nun bu s\u00fcreci nas\u0131l kolayla\u015ft\u0131rd\u0131\u011f\u0131n\u0131 anlad\u0131k. Node.js ile g\u00fc\u00e7l\u00fc bir Socket.IO sunucusu kurarken, Angular ile dinamik ve etkile\u015fimli bir kullan\u0131c\u0131 aray\u00fcz\u00fc geli\u015ftirdik.<\/p>\n<p>Geli\u015ftirdi\u011fimiz basit sohbet uygulamas\u0131, ger\u00e7ek zamanl\u0131 ileti\u015fimin g\u00fcc\u00fcn\u00fc ve bu teknolojilerin birlikte nas\u0131l \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 net bir \u015fekilde g\u00f6sterdi. Ayr\u0131ca, odalar, kimlik do\u011frulama, hata y\u00f6netimi ve \u00f6l\u00e7eklenebilirlik gibi ileri seviye konulara de\u011finerek, uygulaman\u0131z\u0131 daha sa\u011flam, g\u00fcvenli ve performansl\u0131 hale getirmek i\u00e7in atabilece\u011finiz ad\u0131mlar\u0131 inceledik.<\/p>\n<p>Ger\u00e7ek zamanl\u0131 uygulamalar, modern web&#8217;in vazge\u00e7ilmez bir par\u00e7as\u0131d\u0131r ve bu rehberde edindi\u011finiz bilgilerle, kendi yenilik\u00e7i ve etkile\u015fimli uygulamalar\u0131n\u0131z\u0131 geli\u015ftirmek i\u00e7in sa\u011flam bir temele sahipsiniz. Bu teknolojileri kullanarak canl\u0131 panolar, i\u015fbirli\u011fine dayal\u0131 d\u00fczenleyiciler, oyunlar ve \u00e7ok daha fazlas\u0131n\u0131 hayata ge\u00e7irebilirsiniz. Unutmay\u0131n, pratik yapmak ve farkl\u0131 senaryolar\u0131 denemek, bu alandaki yetkinli\u011finizi art\u0131rman\u0131n en iyi yoludur. \u0130yi geli\u015ftirmeler!<br \/>\n<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi\nGer\u00e7ek zamanl\u0131 uygulamalar, modern web deneyiminin ayr\u0131lmaz bir p","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[136],"tags":[],"class_list":{"0":"post-34466","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-node-js","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi\" \/>\n<meta property=\"og:description\" content=\"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi Ger\u00e7ek zamanl\u0131 uygulamalar, modern web deneyiminin ayr\u0131lmaz bir p\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-16T23:40:56+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"23 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi\",\"datePublished\":\"2025-11-16T23:40:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/\"},\"wordCount\":3263,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Node.js\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#respond\"]}],\"copyrightYear\":\"2025\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/\",\"name\":\"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2025-11-16T23:40:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/","og_locale":"tr_TR","og_type":"article","og_title":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi","og_description":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi Ger\u00e7ek zamanl\u0131 uygulamalar, modern web deneyiminin ayr\u0131lmaz bir p","og_url":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2025-11-16T23:40:56+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"23 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi","datePublished":"2025-11-16T23:40:56+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/"},"wordCount":3263,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Node.js"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#respond"]}],"copyrightYear":"2025","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/","url":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/","name":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2025-11-16T23:40:56+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/socket-io-angular-ve-node-js-ile-gercek-zamanli-uygulama-gelistirme-rehberi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Socket.IO, Angular ve Node.js ile Ger\u00e7ek Zamanl\u0131 Uygulama Geli\u015ftirme Rehberi"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/34466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=34466"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/34466\/revisions"}],"predecessor-version":[{"id":34467,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/34466\/revisions\/34467"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=34466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=34466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=34466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}