Socket.io-client: "Símbolo inesperado

Creado en 14 may. 2015  ·  5Comentarios  ·  Fuente: socketio/socket.io-client

Cuando cargo la biblioteca del cliente de la siguiente manera:

Todos 5 comentarios

src="js/socket.io.js"

Tiene que ser src="/socket.io/socket.io.js"

Recibo el mismo error al usar este archivo html:

<!doctype html>
<html lang="en">
<head>
  <!-- The first thing in any HTML file should be the charset -->
  <meta charset="utf-8">
  <!-- Make the page mobile compatible -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Allow installing the app to the homescreen -->
  <link rel="manifest" href="manifest.json">
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css">
  <meta name="mobile-web-app-capable" content="yes">
  <title>AP Flora</title>
</head>
<body>
<!-- The app hooks into this div -->
<div id="app"></div>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically includes all assets (e.g. bundle.js, main.css) with the correct HTML tags, which is why they are missing in this HTML file. Don't add any assets here! (Check out webpackconfig.js if you want to know more) -->
<script src="/socket.io/socket.io.js"></script>
<script>
  const socket = io()
  console.log(`socket:`, socket)
</script>
</body>
</html>

¿Qué estoy haciendo mal?

funciona cuando uso:

<script src="https://cdn.socket.io/socket.io-1.4.0.js"></script>

¿Qué _es_ la URL correcta?

Al llamar a socket.io.js localmente, funcionó cuando uso browserify para compilar los archivos requeridos correctos. Otra forma es usar lib dentro de _socket.io-client_

¿Fue útil esta página
0 / 5 - 0 calificaciones

Temas relacionados

najibghadri picture najibghadri  ·  7Comentarios

gtk2k picture gtk2k  ·  3Comentarios

aravindsrivats picture aravindsrivats  ·  4Comentarios

newpanjing picture newpanjing  ·  3Comentarios

catamphetamine picture catamphetamine  ·  3Comentarios
bleepcoder.com utiliza la información de GitHub con licencia pública para proporcionar a los desarrolladores de todo el mundo soluciones a sus problemas. No estamos afiliados a GitHub, Inc. o a ningún desarrollador que use GitHub para sus proyectos. No alojamos ninguno de los vídeos o imágenes en nuestros servidores. Todos los derechos pertenecen a sus respectivos propietarios.
Fuente de esta página: Fuente

Lenguajes de programación populares
Proyectos populares de GitHub
Más proyectos de GitHub

© 2024 bleepcoder.com - Contact
Made with in the Dominican Republic.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.