[DEV] WebSocket Server - Direct connection between webbrowser and gameserver
5 Attachment(s)
WebSocket A WebSocket protocol implementation to create a direct connection between webbrowsers and gameservers. WebSocket is a protocol designed to create a realtime connection between webbrowsers and webservers via javascript to exchange asynchronous information without reloading the page or requiring a client poll/page refresh. This plugin provides an interface to create such an WebSocket server via SourceMod. Now you're able to do a live webchat seeing ingame events or even following the game in your browser like SourceTV or exchange whatever information you want. This plugin doesn't open a server by itself and doesn't do much alone. It's a base for other plugins to implement fancy stuff without knowing the actual protocol. Code is on github! https://github.com/peace-maker/sm-websocket Acknowledgements This implementation follows the draft version 17 of the websocket protocol specifications, except:
Natives PHP Code:
Compiling dependencies Thanks to
Changelog
Spoiler
Server owners only need the websocket.smx in their plugins folder and the Socket extension installed. This plugin won't compile on the forum due to it's custom include requirements. |
Re: [DEV] WebSocket Server
4 Attachment(s)
Example
Simple Webchat HTML based off phpwebsocket's client.html Creating a connection and listening for events in javascript. Replace the ip and port with the ones you're using in your websocket_test.sp. PHP Code:
You need to strip the .txt suffix off the client.html. The forum won't let me upload .html files. SourceTV2D This is the reason why this plugin was made initially. It's still not finished at all and i'm no javascript pro, so the code isn't easy to read, but it works to some extend. You could preview what's possible with WebSockets over at http://sourcetv2d.wcfan.de/ . It's a realtime stream off our deathmatch server. Be warned, this isn't stable at all and you should only mess with it for testing and improving reasons. Please post any additions you do:) You have to edit the index.html in order to set the right IP of your gameserver to connect to. |
This is really sweet, nice work.
|
Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
Very awesome.
|
Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
Nice. :up:
Hopefully I'll get a chance to test this out myself! |
Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
Peace-Maker why you got my sourcetv2d
|
Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
Quote:
|
Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
The only issue I see with that script that shows players live is that they could cheat with it. They can see anyone on the map at anytime with just a quick look and know where they're at. :P
Note: I mean the example and I know you said it's not perfect but it's a worry of mine. lol |
Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
Quote:
|
Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
Currently the plugin denys connections from ips which are already connected and closes them, if a player who's currently watching in sourcetv2d, joins.
I thought of a buffer to store messages for x seconds until sending them out, but it's easier to test in realtime ;) |
All times are GMT -4. The time now is 02:09. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.