Coder Social home page Coder Social logo

jeromeetienne / easywebsocket Goto Github PK

View Code? Open in Web Editor NEW
149.0 7.0 22.0 18.09 MB

like Websocket but no server setup and available in any browser

Home Page: http://easywebsocket.org

License: MIT License

ActionScript 46.49% Ruby 0.01% Shell 0.02% Perl 0.04% JavaScript 53.25% Python 0.19%

easywebsocket's Introduction

see the homepage

Easy WebSocket

like WebSocket but no server setup and available in any browser

EasyWebSocket aims to make realtimes webapps in every browser without the trouble to setup Websocket servers.

How to use it

Include the following in your webpage and it just works.

<script src="http://EasyWebsocket.org/easyWebSocket.min.js"></script>	
<script>
    var socket = new EasyWebSocket("ws://example.com/resource");
    socket.onopen	= function(){
        socket.send("hello world.")
    }
    socket.onmessage= function(event){
        alert("received"+ event.data)
    }
</script>

Step 1: You connect the socket to a given url

Step 2: What you send() thru this socket is sent to all sockets connected the same url

See this code live. No server setup, no cross-origin issue to care about... It is that easy!

easywebsocket's People

Contributors

jeromeetienne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

easywebsocket's Issues

Problem with http secure

In file "easywebsocket.min.js" it has been configured the websocket server

->EasyWebSocket.serverUrl = "http://88.191.76.230:8950";

but if your aplication it´s running in a secure context (https) , socket.io can´t establish a connection.

The connection was interrupted while the page was loading.

I've been using your fantastic library for a few months. Recently though, my connection started to fail after a few seconds (~23s), or when I send something. It started around this christmas, but I haven't had time to look into it until now.

Firefox, (firebug) reports:
"
The connection to ws://88.191.76.230:8950/socket.io/1/websocket/18883451342134888172 was interrupted while the page was loading.

...this,e;e||(e=window.MozWebSocket||window.WebSocket);this.websocket=new e(this.pr... at: easyWe....min.js (line 43)
"
Chrome fails silently after the same amount of time.

This is the code I am using: this._connection = new EasyWebSocket("ws://students.info.uaic.ro/~tudor.berechet/index.xhtml");
So it is not "wss", as it was mentioned in this issue: #5
Sometimes one or two broadcasts make it through, but usually it keeps failing with that error every time I try to send something.

Haven't had time to look at your un-minified code yet.

No support for Opera Mobile

As of yesterday, after 17 hours the last change was committed, I was testing EasyWebsocket chat demo on my Nexus One with Android 2.3.6. It works on the native browser, FF and FF Aurora 9.2 alpha, but unfortunately not on Opera Mobile 11.5, which I consider to be the best browser for Android. Sometimes some user login messages and messages are displayed and repeated, but others just dropped.

please help me with client refresh through websocekt

Ok I have a page that is running a web socket with a timer, that on a 15 second interval it sends through the socket the value "refresh", on the client pages I have javascript set up I believe to listen for a send event through the web socket and if the information sent is "refresh" for the clients page to refresh...

the problem is once it has been sent once It holds the event data of refresh and just keeps trying to refresh the page as fast as it can... Ive tried a bunch of different options and at first I thought the page would stop refreshing after some time because the socket does not work, but I traced the socekts send with and alert box as apposed to "run this function" and it seems to work...

server Page:

<script src="easyWebSocket.min.js"></script> <script type="text/javascript"> var socket = new EasyWebSocket("ws://localhost/test"); var t; var timer_is_on=0; var interval function startServer(){ interval = setInterval("timedCount()", 15000); } function stopServer(){ clearInterval(interval); } function timeUpdate(){ document.getElementById("servertime").contentWindow.location.reload(); } function timedCount() { timeUpdate(); socket.send("refresh"); } function doTimer() { if (!timer_is_on) { timer_is_on=1; timedCount(); } } </script>
<iframe id=servertime src=timeManager.php></iframe>

CLIENTS PAGE:

<script src="easyWebSocket.min.js"></script> <script type="text/javascript"> var socket = new EasyWebSocket("ws://localhost/test"); socket.onmessage = function(event){ if (event.data=="refresh"){ window.location.replace("GUI.php"); } } </script>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.