https://github.com/ejancorp/ajaxtosocket
Use to convert your ajax polling to a websocket
https://github.com/ejancorp/ajaxtosocket
ajax docker js node nodejs poll socket
Last synced: 2 months ago
JSON representation
Use to convert your ajax polling to a websocket
- Host: GitHub
- URL: https://github.com/ejancorp/ajaxtosocket
- Owner: ejancorp
- Created: 2016-07-01T23:36:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-04-20T17:18:23.000Z (about 8 years ago)
- Last Synced: 2025-09-26T15:34:51.453Z (9 months ago)
- Topics: ajax, docker, js, node, nodejs, poll, socket
- Language: JavaScript
- Size: 114 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AjaxToSocket
Convert your ajax polling request to websocket. Acts like a middleman so that your endpoints will be like socket.
### Install and Run
---
```sh
$ git clone https://github.com/ejancorp/ajaxtosocket
$ cd ajaxtosocket
$ npm install
$ npm build
```
Copy ***.env.example*** as ***.env***
.env should contain
```
APP_PORT=8282
```
Run
```sh
$ npm start
```
### Run using Docker Compose
```sh
$ docker-compose up -d --build
```
### Test
```sh
$ npm run test
```
### Usage
```javascript
var socket = io.connect('http://localhost:8282', { query: "url=exampleapi.com/all&interval=3000" });
socket.on('response', function(data) {
// to anything about the data
console.log(data)
});
```
### Todos
- Write MORE Tests
- Accept POST Method