by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Max Lyashuk
    @probil
    Let's discuss vue-socket.io-extended here. Feel free to ask any questions you have :) I will try to respond as soon as possible
    Harishankar Ayandev
    @harishankards
    Wow
    Great to create a channel
    Thanks @probil
    Max Lyashuk
    @probil
    Have you fixed your issue #71 @harishankards ?
    Harishankar Ayandev
    @harishankards
    No @probil. This is my side project. Completely stuck up with office works for a few days. 2-3. Will respond. Thanks for understanding
    Harishankar Ayandev
    @harishankards
    Hi @probil
    It's been a long time
    How you doing buddy
    Thought I would implement the chat system
    Max Lyashuk
    @probil
    Hi, @harishankards I'm fine and you? Sorry for the late response I was on vacation
    I got your question #108 and will respond you soon :)
    Harishankar Ayandev
    @harishankards
    Hi @probil , that's completely fine man.
    Sure . No issues buddy
    Max Lyashuk
    @probil
    I've just answered. Let me know if you have any other questions :)
    Harishankar Ayandev
    @harishankards
    Sure mate
    Harishankar Ayandev
    @harishankards
    Hey @probil
    How are you doing man?
    I just took my side project and started working on it again
    In my project, I'm just trying to create a chat room for every project. There will be thousands of projects and I would like to keep the chatrooms for every project. So for 100 projects, I'll have 100 chatrooms. Can you give me a outline of how to do it? Or the best practices followed?
    Max Lyashuk
    @probil

    Hi, @harishankards
    Nice too see you again. I'm fine and you?

    You can use rooms for that
    https://socket.io/docs/rooms-and-namespaces/#Rooms
    Also you may want to use socket.io-redis to run multiple socket.io instances in different processes or servers that can all broadcast and emit events to and from each other.
    https://github.com/socketio/socket.io-redis

    In general there no changes on front-end at all but most of them are on back-end.
    When user connects you should verify him, add join him to all rooms he belongs to.

    io.on('connection', async socket => {
      try {
        const user = await authUserBySocket(socket); // -> user = { username: 'johnDoe', email: 'john.doe@gmail.com' }
      } catch (e) {
        socket.disconnect();
      }
      const rooms = await getUserRooms(user);  // -> rooms = ['room1', 'room2', 'room16'];
      rooms.forEach(room => socket.join(room)); 
    });
    
    // later in code
    io.to('room16').emit('will be accepted only by users in room 16');
    Harishankar Ayandev
    @harishankards
    Yep. Doing good man
    Sure I'll try that
    Roman Storm
    @rstormsf
    can anyone share a public github repo with usage of socket.io-extended? thanks
    Kevin Elliott
    @kevinelliott
    Hey there, can anyone tell me what advantages vue-socket.io-extended has over vue-websocket or vue-native-websocket?
    frankie
    @frankie-zeng
    hello
    Max Lyashuk
    @probil
    @rstormsf
    You can find simple example in the repo now. More examples comming soon
    Max Lyashuk
    @probil
    @kevinelliott
    In comparison with vue-websocket:
    • vue-websocket doesn't support vuex at all
    • with vue-websocket you can't easily switch between different versions of socket.io client since it's hardcoded, with vue-socket.io-extended you can
    • with vue-websocketyou can't useslimversion of socket.io client which is 10kb lighter (good for production builds), withvue-socket.io-extended` you can
    • vue-websocket doesn't work in IE11 support
    • vue-socket.io-extended has typescript decorators and typescript typings (vue-websocket don't)
    • vue-socket.io-extended has reactive properties (vue-websocket don't )
    • vue-websocket supports Vue.js v1 (vue-socket.io-extended don't)
    @kevinelliott vue-native-websocket works only with native websockets, vue-socket.io-extended works only with socket.io
    mystermiam
    @mystermiam
    Hi, does this module works with namescaped store ? Because the listeners are not working for me
    Kevin Elliott
    @kevinelliott
    Thanks @probil
    Also, I'm having a problem accessing this.$store from the socket listeners... does anyone know how to do it?
    Screen Shot 2019-10-30 at 6.00.09 PM.png
    John
    @flyboy1565
    hello completely new here
    trying to learn and use this.

    I have an express.js file

    SocketIo.on("connection", socket => {
        console.log(socket.id)
    
        socket.on('start_a_game', function () {
            console.log('Starting a game?')
            let game = new Game()
            let player = game.add_player(socket.id)
            games.push(game)
            socket.emit('joined', game)
            socket.emit('init', player)
            socket.join(game.game_id.uuid)
        })
    })

    here is my vuex

    
    export default new Vuex.Store({
        state: {
            // objects 
            isConnected: false,
        },
        getters: {
            // getting data
        },
        mutations: {
            // updates objects
            SOCKET_CONNECT(state) {
                state.isConnected = true;
            },      
            SOCKET_DISCONNECT(state) {
                state.isConnected = false;
            },
            SOCKET_JOINED(state, payload) {
                console.log('Joined:', payload)
            },
            SOCKET_INIT(state, payload) {
                console.log('init:', payload)
            },
            SOCKET_START_A_GAME() {
                // Vue._vm.$socket.client.emit('start_a_game')
            }
    
        },
        actions: {
            // pulls data and uses mutations 
            create_a_room({commit}) {
                commit ("SOCKET_START_A_GAME")
            }
        }
    })

    from a component

      methods: {
          join_room () {
              this.$store.dispatch("join_a_room", {code: this.code})
          },
          create_room () {
              this.$store.dispatch("create_a_room")
          }
      },
    I'm trying to understand how this is supposed to work
    John
    @flyboy1565
    @here @all is this room dead?
    biplobweblancer
    @biplobweblancer
    vue-router not working (getting error - Uncaught (in promise) TypeError: _this2.$socket.$subscribe is not a function), but page reloading is working. Any solution? Please help