Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

local view 테스트 방법 공유. #103

Closed
kimsehwan96 opened this issue Apr 17, 2021 · 1 comment
Closed

local view 테스트 방법 공유. #103

kimsehwan96 opened this issue Apr 17, 2021 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@kimsehwan96
Copy link
Owner

localview 에서 소모할 socketio 데이터를 테스트 하는 방법을 공유드립니다.

<!doctype html>
<html>
<body>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script>
    const binder = io("http://3.34.87.77:5000/binder");

        binder.on('rtdata', (data) => {
            console.log('binder buffered: ', data);
        });

</script>
<H1> Hello world</H1>
</body>
</html>

우선 이렇게 간단한 코드로 테스트 완료하였습니다.

제가 개인적으로 사용하는 서버의 ip가 3.34.87.77 입니다.

그리고 socketio를 사용하기 위한 포트는 5000번입니다.

그리고 실시간 데이터가 들어오는 네임스페이스는 /binder 입니다.

추후 실시간 유류비 계산과 같은 데이터는 네임스페이스가 달라지겠지만, 그 외 실시간 데이터는 다 여기서 들어옵니다.

{
  "fields": [
    "engine_load",
    "engine_coolant_temp",
    "engine_rpm",
    "vehicle_speed",
    "maf_sensor",
    "o2_voltage",
    "throttle",
    "short_fuel_trim_bank",
    "long_fuel_trim_bank",
    "intake_air_temperature",
    "engine_runtime",
    "traveled_distance",
    "fuel_tank_level",
    "ambient_air_temperature",
    "engine_oil_temperature",
    "transmission_actual_gear"
  ],
  "values": [71, 86, 70, 99, 43, 49, 40, 71, 2, 39, 98, 61, 5, 60, 90, 70],
  "timestamp": 1618669837.2445838
}

위와 같은 형태로 데이터를 받아볼 수 있습니다. 프론트 코드쪽에서 const binder = io("http://3.34.87.77:5000/binder"); 부분의 url 부분 (3.34.87.77) 부분만 추후 로컬에서 사용할때 localhost로 바꿔주면 동일한 동작을 할 것입니다.

정리내용

테스트를 위한 url은 http://3.34.87.77:5000 (추후 로컬에서 사용 시 http://localhost:5000 으로 변경할 예정)

실시간 데이터의 네임스페이스는 /binder, 이벤트 명은 rtdata

데이터 구조는 위에 작성한 json 데이터와 동일함.

유류비 관련 데이터는 개발 진행중, 개발 완료후 공유 예정

@kwhong95 확인 부탁드립니다.

@kimsehwan96 kimsehwan96 added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 17, 2021
@kimsehwan96
Copy link
Owner Author

@kwhong95 버전문제와 같은 이슈가 발생할수도 있습니다. 리액트 앱에서 socketio 설치해서 테스트해보고 오류가 발생하면 이야기 해주세요.

@kimsehwan96 kimsehwan96 pinned this issue Apr 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants