ratchetphp / Ratchet

Asynchronous WebSocket server
http://socketo.me
MIT License
6.28k stars 743 forks source link

wss not working in https but ws works in http on localhost #980

Open sarveshtr opened 2 years ago

sarveshtr commented 2 years ago

error on connection-:

   WebSocket connection to 'wss://dev.emedicoz.com:2010/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

client connection

      <script src="$socketjs"></script>
      <script type="text/javascript" language="javascript" >

        function set_template(){
            var id = $('select[name=template]').val();

            CKEDITOR.instances['message'].setData($('#tarea_'+id).val());

        }

        var socket=$.websocket('wss://$base:2010');

          $('#bulk_push').submit(function() {

                var users_type = $('.bulk_user_type').val();
                var users_message = CKEDITOR.instances['message'].getData() ;// $('.bulk_user_message').val();
                var users_subject = $('input[name=subject]').val();

                if(users_subject == "" ){
                    show_toast('error', 'Please type subject for email.' , "Subject Error");
                    return false;
                }

                if(users_message == "" ){
                    show_toast('error', 'Please type message for users.' , "Subject Error");
                    return false;
                }

                if(users_message){
                   // $('.bulk_button').hide();
                    json_var = {};
                    json_var.users_type =  users_type;
                    json_var.users_message =  users_message;
                    json_var.users_subject =  users_subject;

                    //console.log(json_var);
                    socket.emit('sync_process', json_var);

                }
                $('.bulk_user_message').val('');
                return false;
          });

          socket.on('sync_process', function(msg){
            $('#show_socket_state').html('</br>'+msg);
                      console.log(msg);
          });
          socket.on('connect', function(user){
             $('.bulk_button').show();
              $('#show_socket_state').html('<i class="fa fa-check" aria-hidden="true"></i> You are connected to server.');
              $('#show_socket_state_btn').hide();

              console.log('web_socket connected');
          });

        socket.listen();
      </script>
nstwfdev commented 1 year ago

Hello. Show your app apache/nginx config