Skip to content

Commit

Permalink
docs: points towards the website
Browse files Browse the repository at this point in the history
The website is now much more stable, so there's no need to keep two
copies of the same content (which must be manually kept in sync).
  • Loading branch information
darrachequesne committed Jan 8, 2021
1 parent bcdd3be commit 4922e39
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 735 deletions.
44 changes: 4 additions & 40 deletions README.md
Expand Up @@ -10,43 +10,11 @@

[![Sauce Test Status](https://saucelabs.com/browser-matrix/socket.svg)](https://saucelabs.com/u/socket)

## How to use
## Documentation

A standalone build of `socket.io-client` is exposed automatically by the
socket.io server as `/socket.io/socket.io.js`. Alternatively you can
serve the file `socket.io.js` found in the `dist` folder or include it via [CDN](https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js).
Please see the documentation [here](https://socket.io/docs/v3/client-initialization/).

```html
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});
</script>
```

```js
// with ES6 import
import io from 'socket.io-client';

const socket = io();
```

A slim build (without [debug](https://github.com/visionmedia/debug)) is also available: `socket.io.slim.js`.

Socket.IO is compatible with [browserify](http://browserify.org/) and [webpack](https://webpack.js.org/) (see example [there](https://github.com/socketio/socket.io/tree/2.0.3/examples/webpack-build)).

### Node.JS (server-side usage)

Add `socket.io-client` to your `package.json` and then:

```js
var socket = require('socket.io-client')('http://localhost:3000');
socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});
```
The source code of the website can be found [here](https://github.com/socketio/socket.io-website). Contributions are welcome!

## Debug / logging

Expand All @@ -56,11 +24,7 @@ In order to see all the client debug output, run the following command on the br
localStorage.debug = '*';
```

And then, filter by the scopes you're interested in. See also: https://socket.io/docs/logging-and-debugging/

## API

See [API](/docs/API.md)
And then, filter by the scopes you're interested in. See also: https://socket.io/docs/v3/logging-and-debugging/

## License

Expand Down

0 comments on commit 4922e39

Please sign in to comment.