Merge pull request #177 from tekn0ir/fix_libssl_example

Fix linking error on OSX & fix websocket example
This commit is contained in:
Jaeseung Ha 2017-09-17 19:15:03 +09:00 committed by GitHub
commit 6df366ce1d
3 changed files with 12 additions and 5 deletions

View File

@ -19,7 +19,13 @@ endif()
add_executable(example_websocket websocket/example_ws.cpp) add_executable(example_websocket websocket/example_ws.cpp)
target_link_libraries(example_websocket ${Boost_LIBRARIES}) target_link_libraries(example_websocket ${Boost_LIBRARIES})
target_link_libraries(example_websocket ${CMAKE_THREAD_LIBS_INIT} ssl crypto) target_link_libraries(example_websocket ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES})
add_custom_command(OUTPUT ws.html
COMMAND ${CMAKE_COMMAND} -E
copy ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html ${CMAKE_CURRENT_BINARY_DIR}/ws.html
DEPENDS ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html
)
add_custom_target(example_ws_copy ALL DEPENDS ws.html)
add_executable(example example.cpp) add_executable(example example.cpp)
#target_link_libraries(example crow) #target_link_libraries(example crow)

View File

@ -12,6 +12,7 @@
</textarea> </textarea>
<script> <script>
var sock = new WebSocket("ws://{{servername}}:40080/ws"); var sock = new WebSocket("ws://{{servername}}:40080/ws");
sock.onopen = ()=>{ sock.onopen = ()=>{
console.log('open') console.log('open')
} }