vincentriemer / react-native-dom

An experimental, comprehensive port of React Native to the web.

Home Page:https://rntester.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can not use socket.io

shinyoshiaki opened this issue · comments

can not to connect socket.io server via socket.io client.

commented

@shinyoshiaki Can you elaborate at all?

I can confirm that it is possible (I'm doing it right now w/ socket.io) to use websockets w/ react-native-dom. Maybe I can help your use case.

My use case is very simple that is just a test.

import React from "react";
import { StyleSheet, Text, View } from "react-native";
import client from "socket.io-client";

export default class App extends React.Component {
  constructor(props) {
    super(props);    
    const targetUrl = "http://" + target.address + ":" + target.port;
    const socket = client.connect(targetUrl);
  }

But it was not work 3 month ago.
I did not check it now. so I do not know this code work or not work right now.

Can you use websockets on rn-dom right now?

commented

Yeah it's possible. I got a couple warnings about certain headers not being acceptable, but the functionality was there across all major browsers.

I'm using "socket.io-client": "^2.1.1"