adonisjs / adonis-websocket-client Goto Github PK
View Code? Open in Web Editor NEWWebsocket client for AdonisJs framework.
Websocket client for AdonisJs framework.
Hello,
not sure if it real issue, but you can't connect to channel with auth middleware after connection to public channel because the connection is reused and credentials not sent. I'm talking about this:
/**
* Do not connect again if already connected
*/
if (this._io) {
return this;
}
/**
* Sending authentication querystring when one of
* the authentication method is being called.
*/
if (this._authQuery) {
this._options.query = this._authQuery;
}
this._io = this._socketIoGlobal(this._url + '/' + this._namespace, this._options);
Hello,
not sure if it real issue, but you can't connect to channel it error document is not defined ('node_modules\adonis-websocket-client\dist\ws.js'). in here my code:
import Vue from 'vue' import ws from 'adonis-websocket-client' const wsVuePlugin = function (Vue, url, options) { Vue.prototype.$io = ws(url, options) } Vue.use(wsVuePlugin, 'http://localhost:3000', {})
export default { created: function () { this.$io.channel('chat').connect(console.log) } }
Hi,
I have ran into the issue when using adonis-websocket-client
inside Web Workers, this is due to the fact that the Worker doesn't have window
variable.
Thanks,
Vlad
has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
when I try use with react display it, but my api work, in my file cors.js are * in origin
Branch | Build failing π¨ |
---|---|
Dependency | socket.io-client |
Current Version | 1.7.1 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
As socket.io-client is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you itβs very likely also breaking them.
I recommend you give this issue a very high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | mocha |
Current Version | 3.4.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As mocha is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 7 commits.
a15b20a
:ship: Release v3.4.2
fc802a9
:memo: Add Changelog for v3.4.2
10ff0ec
Eagerly set process.exitCode (#2820)
fc35691
Merge pull request #2818 from makepanic/issue/2802
3e7152f
Remove call to deprecated os.tmpDir (#2802)
e249434
Merge pull request #2807 from mochajs/npm-script-lint
17a1770
Move linting into an npm script. Relates to #2805
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Websocket connection to 'ws://localhost:3333/adonis-ws connection' closed before receiving a handshake response
I use with react but display it
index.js?41f5:15 Uncaught TypeError: ws.connect is not a function
const ws = Ws('ws://192.168.0.101:3333')
ws.connect()
https://github.com/adonisjs/adonis-websocket-client/blob/develop/src/Connection/index.js#L583
When connecting to the socket without token
query param and trying to connect to channel with withJwt()
method - if fails.
Connection URL: ws://localhost:8081/socket.io/EIO=3&transport=websocket&sid=w9gDx_6eLxRiffcRAAAD
But after refresh, the connection is with token
query param and connection to the channel is ok.
Connection URL:
ws://localhost:8081/socket.io/?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjp7InVpZCI6MX0sImlhdCI6MTUwNTcwMDE3NCwiZXhwIjoxNTA1Nzg2NTc0fQ.vA-4Cekta05M6IOKQiCXq42rLuf6wTA1qeGcWjK3bA0&EIO=3&transport=websocket&sid=HKc7o7ftvSxidnfSAAAB
Maybe there is a option to reconect to the sockets with token
in query?
I have this situation when user is going from guest to auth mode.
So from login page to dashboard page.
Title says it all
something like this would be wonderful
const chat = ws.unsubscribe('chat')
Hi!
I'm new on NodeJS and AdonisJS but I really need an example of how to make a client (backend, not frontend) to connect to my AdonisJS websocket server. The AdonisJS + websocket server is OK.
Thanks!
Mauricio
This is the fix to the problem I see a lot of you are having with the WebSocket client and is not included in the docs. Just npm install and import babel-polyfill.
import Ws from '@adonisjs/websocket-client'
import Vue from 'vue'
// production change ws:// to wss:// for security
var ws = Ws('ws://localhost:3333')
ws.connect()
ws.on('open', () => {
alert('Connected to server.')
})
I have a React Native app with Adonis backend where I am implementing a chat system with Websockets, so I would like to use Adonis Websocket client as well.
I have an error to connect, as window.location.protocol and window.location.host don't exist without the browser.
Would be possible to handle the code to make everything work fine?
Thanks!
Hi I'm trying to use this together with adonuxt-boilerplate
nuxt.js
plugins: [
{ src: "~plugins/ws.js", ssr: false },
]
}
~/plugins/ws.js
import Ws from "@adonisjs/websocket-client";
const ws = Ws("ws://localhost:3333");
export default (ctx, inject) => {
console.log(ctx);
console.log(ws);
// ctx.$ws = ws;
// inject("ws", ws);
};
Error is
ReferenceError
regeneratorRuntime is not defined
Error preview server-bundler.js
exports.NuxtError = exports.createApp = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var createApp = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ssrContext) {
var _this = this;
var router, store, app, next, route, path, inject;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
Branch | Build failing π¨ |
---|---|
Dependency | babel-loader |
Current Version | 6.2.9 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-loader is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
Support for webpack 2.2-rc has been added in this release
The new version differs by 5 commits .
f221f6c
6.2.10
3bbfbf5
Fallback for cache directories (#346)
35272ef
Add Webpack 2.2 RC as peerdependency (#348)
d264da0
Do not include comments in releases
f09bdd1
run clean on prePublish [skip ci]
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Hi,
I am trying to run some client side sockets in electron to connect to an Adonis dashboard and backend. I'm getting the following error when trying to import the "Ws" package from node modules. Thinking it may have something to do with my project configuration but couldn't see anything that stood out.
export default index;
^^^^^^
SyntaxError: Unexpected token export
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:606:28)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at eval (webpack:///external_%22@adonisjs/websocket-client%22?:1:18)
My repo is here in case you may need to check something in my app configuration https://github.com/jaymeh/time-tracking-electron.
I am including the package in "src/main/index.js".
Thanks!
Hi,
How to use websocket client when running nodejs process? I'm creating daemon that will communicate via websocket (sending commands from GUI to daemon). Is there any way to use this library for that?
As far as I tested, it throws error on windows is not defined. I have found some workaround here: #67 (comment) but then I receive another issue: WebSocket is not defined
.
If I connect to a channel:
this.channel = ws.subscribe('channel');
Close its connection:
this.channel.close();
And then try to subscribe to the same channel after I closed it:
this.channel = ws.subscribe('channel');
The client throws an error with the message "Cannot join the same topic twice".
One would say: You can use getSubscription() to get the active subscription instead of trying to connect to it again. But the getSubscription() method doesn't return closed subscriptions.
Is this the expected behavior?
Hi. I'm trying to install adonis-websocket-client with bower but the missing comma from the #31 line of bower.json throws Failed to read
error. I hope you fix it as soon as possible. Have a good day π
Branch | Build failing π¨ |
---|---|
Dependency | babel-core |
Current Version | 6.20.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-core is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | babel-core |
Current Version | 6.23.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-core is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | babel-preset-latest |
Current Version | 6.22.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-preset-latest is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Hi,
Is there any way to have a node websocket client connect to the adonis js websocket server?
I've been trying for a long time now, but am unable to get it connected.
Hello,
when i using this websocker client of socket.io on android Using java i cannot to connect the server
what is URI should i use to connect the server?
i'm using this websocket client 'http://socket.io/blog/native-socket-io-and-android/'
and this is my function in java (android)
private void connectWebSocket() {
URI uri;
try {
uri = new URI("ws://localhost:3333");
} catch (URISyntaxException e) {
e.printStackTrace();
return;
}
mWebSocketClient = new WebSocketClient(uri) {
@Override
public void onOpen(ServerHandshake serverHandshake) {
Log.i("Websocket", "Opened");
mWebSocketClient.send("Hello from " + Build.MANUFACTURER + " " + Build.MODEL);
}
@Override
public void onMessage(String s) {
final String message = s;
runOnUiThread(new Runnable() {
@Override
public void run() {
TextView textView = (TextView)findViewById(R.id.username_input);
textView.setText(textView.getText() + "\n" + message);
}
});
}
@Override
public void onClose(int i, String s, boolean b) {
Log.i("Websocket", "Closed " + s);
}
@Override
public void onError(Exception e) {
Log.i("Websocket", "Error " + e.getMessage());
}
};
mWebSocketClient.connect();
}
Hey! I can not understand what I have to do for getting it in my HTML file?
I've tried to use a code like that:
<script src="../node_modules/@adonisjs/websocket-client/dist/Ws.browser.js"></script>
but I've got:
Ok, I've saw a notice about polyfill but I just want to connect the build to my HTML and use it. I'm confused. What I have to do?
With
channel('radio').on('presence:state', (user) => ...
I get only the list of users in a channel, after someone logs in. Is there a possibility to get the users directly?
adonis-websocket-client can use in website what if I want to use it on android? cause, I'm making web services for android and, I'm using socket chat, adonis-websocket is so good i like it :), but I can't use it on android, Is there any solution.
i am new to nodejs and adonisjs and struggling hard to learn them, i am trying to use adonis web socket client and it is now working fine but i have one issue i am not able to remove console logs provided by default with adonisjs, can anyone please provide step by step instructions to remove console logs in browser
Hi is it possible to use websocket in flutter? They have a nice package for pure websocket
https://pub.dev/packages/web_socket_channel
I was able to connect websocket from the app and also was able to receive data from adonis server. But I am not being able to send data from flutter app adonis.
Is there implementation for flutter? Thank you.
const io = ws(API, {timeout:30000});
Branch | Build failing π¨ |
---|---|
Dependency | coveralls |
Current Version | 2.13.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As coveralls is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 3 commits.
5ebe57f
bump version
428780c
Expand allowed dependency versions to all API compatible versions (#172)
eb1b723
Update Mocha link (#169)
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Vue-CLI-3's configuration uses double quotes instead of single quotes when defining process.env.NODE_ENV.
Currently the websocket client only checks for: process.env.NODE_ENV !== 'production'
causing debug console logs to be pushed even in production environments for Vue apps.
The if statements in src/connection/index.js that allow debug logs to occur should also check for process.env.NODE_ENV !== "production"
or have a debug option to disable these logs.
Hi,
I'm trying to create ws app with adonisjs and vuejs but adonis' ws client for vuejs always throws so much debug messages to console. Is there a way to open or close it without changing NODE_ENV ? It would be great to pass debug: false parameter to Ws object
Hi, is this repo deleted?
https://github.com/adonisjs/adonis-websocket-vue
It is referenced in Readme.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.