icebob / vue-websocket Goto Github PK
View Code? Open in Web Editor NEWSimple websocket (socket.io) plugin for Vue.js
License: MIT License
Simple websocket (socket.io) plugin for Vue.js
License: MIT License
Access to XMLHttpRequest at 'http://localhost:8089/socket.io/?EIO=3&transport=polling&t=Mgq_ykZ' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Look like #7
But we need set option before connect but not in Vue.use
main.js
Vue.use(VueWebsocket, null, { autoConnect: false });
App.vue
created() {
// Like this? get the bar before connect
this.$socket.option = {
query: 'foo='+bar,
'transports': ['websocket'],
}
this.$socket.open();
}
Thanks
I'm trying to use the package to set a wss:// connection to a domain to be able to use my WebSockets and I'm setting in the options the secure: true part but I'm unable to get my wss connection working. I'll post some screenshots as well as trying to elaborate more.
Code configuration of the socket:
Chrome DevTools Socket Inspection in Console:
Curiously I have set in Constants.real_url the URL of my WebSocket as so: http://... because I was previously using socket.io-client but changed to using this package instead. Now I'm seeing that if it's defined as http:// automagically the secure option is set to false and a ws:// connection, if I define the url as https:// I get a wss:// connection but I am unable to connect correctly I get a Status Code: 400 Bad Request.
I'm hoping you can help me clear a few doubts about how and why I need to set the hostname with HTTPS to get a wss connection, I was able to set a wss connection only using socket.io-client using my hostname as HTTP. Our WebSockets server need the HTTP protocol to correctly work but using a WSS protocol.
socket.io allows client to specify a room.
Could you provide some examples to join a room please?
Does this package support IE11?
Just found out, https://github.com/nathantsoi/vue-native-websocket don`t support IE11
Now I have to rewrite the implementation
The README should be updated since I'm guessing you took the README from another project.
vue-touch-keyboard is available under the MIT license.
try many different way and different ways.still not working.can you please give a full demo.thank you.
This plugin can be linked to the suffix URL
Is it possible to set JWT token as header in the connection settings?
Is it possible to use native websockets instead of socket.io?
insert script in html
<script type="text/javascript" src="../vue-min.js"></script>
<script type="text/javascript" src="../vue-websocket.js"></script>
<body>
<div id="app"></div>
</body>
<script>
Vue.use(VueWebsocket,"ws://a.c/b");
new Vue({el: '#app'});
</script>
In F12 network log, can't see any websocket post? but console has no error print.
so how to use in this case?
thanks
If I have a component which has a socket
property as documented in the vue-websocket's README, is there a way to subscribe to listen on multiple prefixes? The documentation only shows how to listen on a single prefix in a component. 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.