Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itemconsulting/lib-xp-wsutil
Server side web socket utility library
https://github.com/itemconsulting/lib-xp-wsutil
enonic-xp websockets xp
Last synced: 14 days ago
JSON representation
Server side web socket utility library
- Host: GitHub
- URL: https://github.com/itemconsulting/lib-xp-wsutil
- Owner: ItemConsulting
- License: apache-2.0
- Created: 2017-09-27T09:41:13.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2021-04-28T11:40:57.000Z (over 3 years ago)
- Last Synced: 2024-11-12T07:16:14.261Z (2 months ago)
- Topics: enonic-xp, websockets, xp
- Language: JavaScript
- Homepage:
- Size: 952 KB
- Stars: 2
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Enonic XP web socket utility library #
[![](https://jitpack.io/v/no.item/lib-xp-wsutil.svg)](https://jitpack.io/#no.item/lib-xp-wsutil)
## Dependencies
Add the repository and dependencies in your *build.gradle* file
```groovy
repositories {
maven { url 'https://jitpack.io' }
}dependencies {
include "com.enonic.xp:lib-portal:${xpVersion}"
include "com.enonic.xp:lib-io:${xpVersion}"
include "com.enonic.xp:lib-websocket:${xpVersion}"
include "no.item:lib-xp-wsutil:2.0.0"
}
```## Documentation ##
Go [here](https://itemconsulting.github.io/lib-xp-wsutil/) for documentation
## Versions ##
### 2.0.0 ###
* Turn of logging by setting `no.item.wsUtils.printLog` to `false` in the config file for the project using this lib.
* Upgraded to build on XP 7.5.0.
* Compatibility Enonic XP 7.5.0.### 1.1.1 ###
* Added ```getWsEvents``` method to improve reusability
### 1.0.0 ###
* Initital releaseCompatibility Enonic XP 6.4.0
## Files included ##
```
src/
|- main/
|- resources/
|- assets/
| |- clientws.js // Client side library
|- lib/
|- virtual.js // Virtual documentation file
|- wsUtils.js // Server side library
```## Hello sockets ##
Here is the shortest example for opening websocket communication in your project
```html
```
```javascript
// Create a service called websocket
var ws = require('/lib/wsUtil');
ws.openWebsockets(exports);
```
```javascript
// Create an asset called clientws.js
var clientWs = new ExpWS();
clientWs.connect();
```
Check the console/server logs to see that your connection is alive## License ##
This project is under the Apache 2.0 license. For more information please read [LICENSE.txt](LICENSE)
## Author ##
**Per Arne Drevland** *Consultant* [Item Consulting AS](https://item.no)